forked from tapaswenipathak/Horoscope-API
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1a48097
commit 203be8f
Showing
3 changed files
with
140 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
web: newrelic-admin run-program gunicorn -b 0.0.0.0:$PORT server:app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Flask==0.10.1 | ||
Jinja2==2.7.3 | ||
MarkupSafe==0.23 | ||
Werkzeug==0.9.6 | ||
beautifulsoup4==4.3.2 | ||
gunicorn==19.0.0 | ||
itsdangerous==0.24 | ||
newrelic==2.22.1.20 | ||
horoscope==0.1.1 | ||
wsgiref==0.1.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
from flask import Flask, jsonify | ||
from horoscope import Horoscope | ||
|
||
app = Flask (__name__) | ||
|
||
############################################ | ||
# Index | ||
############################################ | ||
|
||
@app.route ('/', methods=['GET']) | ||
def index_route () : | ||
return jsonify({ | ||
'author' : 'Tapasweni Pathak', | ||
'author_url' : 'http://tapasweni-pathak.github.io/', | ||
'base_url' : 'horoscope-api.herokuapp.com', | ||
'project_name' : 'Horoscope API', | ||
'project_url' : 'http://tapasweni-pathak.github.io/pyhoroscope/' | ||
}) | ||
|
||
|
||
############################################ | ||
# Horoscopes | ||
########################################### | ||
|
||
#Todays' Horoscope | ||
@app.route ('/horoscope/today/<sunsign>', methods=['GET']) | ||
def today_horoscope_route (sunsign) : | ||
result = dict (Horoscope.get_todays_horoscope (sunsign)) | ||
return jsonify (date=result['date'], | ||
sunsign=result['sunsign'], | ||
horoscope=result['horoscope']) | ||
|
||
|
||
#Current Week Horoscope | ||
@app.route ('/horoscope/week/<sunsign>', methods=['GET']) | ||
def weekly_horoscope_route (sunsign) : | ||
result = dict (Horoscope.get_weekly_horoscope (sunsign)) | ||
return jsonify (week=result['week'], | ||
sunsign=result['sunsign'], | ||
horoscope=result['horoscope']) | ||
|
||
#Current Month Horoscope | ||
@app.route ('/horoscope/month/<sunsign>', methods=['GET']) | ||
def monthly_horoscope_route (sunsign) : | ||
result = dict (Horoscope.get_monthly_horoscope (sunsign)) | ||
return jsonify (month=result['month'], | ||
sunsign=result['sunsign'], | ||
horoscope=result['horoscope']) | ||
|
||
#Current Year Horoscope | ||
@app.route ('/horoscope/year/<sunsign>', methods=['GET']) | ||
def yearly_horoscope_route (sunsign) : | ||
result = dict (Horoscope.get_yearly_horoscope (sunsign)) | ||
return jsonify (year=result['year'], | ||
sunsign=result['sunsign'], | ||
horoscope=result['horoscope']) | ||
|
||
|
||
########################################### | ||
# More Information About A Sunsign | ||
########################################### | ||
|
||
@app.route ('/knowmore/<sunsign>', methods=['GET']) | ||
def know_more_route (sunsign) : | ||
result = dict (Horoscope.know_all_about (sunsign)) | ||
return jsonify (sanskrit_name=result['sanskrit_name'], | ||
meaning_of_name=result['meaning_of_name'], | ||
lord=result['lord'], | ||
lucky_color=result['lucky_color'], | ||
lucky_day=result['lucky_day'], | ||
lucky_number=result['lucky_number']) | ||
|
||
|
||
########################################### | ||
#Start Flask | ||
########################################### | ||
|
||
if __name__ == "__main__": | ||
app.run() | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|