Skip to content
This repository was archived by the owner on Jun 3, 2020. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d09f082

Browse files
committedApr 5, 2019
adding index date
1 parent 5b4f36e commit d09f082

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed
 

‎webapi.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import ray_casting as r
66
import lookup_table as table
77
import pickle
8+
import datetime
89

910
os.chdir("/home/chenyu_shi/SpeciesLookup")
1011
app = Flask(__name__, static_url_path='/static')
@@ -14,10 +15,12 @@
1415
grid_cells = pickle.load(fileObject)
1516
fileObject.close()
1617

18+
1719
@app.route('/')
1820
def home():
1921
return current_app.send_static_file("index.html")
2022

23+
2124
@app.route('/about/')
2225
def api_root():
2326
"""
@@ -56,6 +59,7 @@ def get(points):
5659
message = """unknown error, try specieslookup.berkeley.edu/about/ for instructions on query formatting"""
5760
return message, 400
5861

62+
5963
@app.route('/search_json/<points>')
6064
def get_json(points):
6165
"""
@@ -74,12 +78,16 @@ def get_json(points):
7478
par = k.parser(species)
7579
if par.inside(point):
7680
# check cached results to see if each specie's range map contains this point
77-
result.append({"class": par.class_name,"order": par.order,"family": par.family, "scientific_name": species, "url": par.url})
81+
now = datetime.datetime.now()
82+
result.append(
83+
{"class": par.class_name, "order": par.order, "family": par.family, "scientific_name": species,
84+
"url": par.url, "index_date": str(now)})
7885
result.sort(key=lambda x: x["scientific_name"])
7986
return jsonify(count=len(result), species=result), 200
8087
except:
8188
message = """unknown error, try specieslookup.berkeley.edu/about/ for instructions on query formatting"""
8289
return message, 400
8390

91+
8492
if __name__ == '__main__':
8593
app.run()

‎webapi.wsgi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# activate Python virtual environment
2-
# trigger something
2+
# trigger something
33
import sys
44
activate_this = '/home/chenyu_shi/venv/bin/activate_this.py'
55
with open(activate_this) as file_:

0 commit comments

Comments
 (0)
This repository has been archived.