Created
October 27, 2014 16:29
-
-
Save oceanzus/994c2905d631fcce6fb0 to your computer and use it in GitHub Desktop.
Example uframe service call from training
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
@app.route('/seabedcriteria/<soiltype>') | |
@support_jsonp | |
def getSeabedCriteria(soiltype): | |
''' | |
NOTE: Will NOT work without Raytheon uframe server connected to the network | |
and running the example OceanBottomService from the training class | |
Accepts a path query for a seabedcriteria uframe DAO example query | |
Usage Example: http:localhost:5000/seabedcriteria/Rock | |
''' | |
#TODO: Move to ooiservices | |
try: | |
r = requests.get('http://192.168.120.4:12574/seabedcriteria/' + soiltype) | |
returned_text = r.text | |
returned_text_array = returned_text.splitlines() | |
final_resp = {} | |
for l in returned_text_array: | |
ll = l.split(',') | |
final_resp[ll[6]] = {'Code':ll[0],'Id':ll[1],'Seabed':ll[2],'Sourcethm':ll[3],'latitude':ll[4],'longitude':ll[5]} | |
array_list = json.dumps(final_resp, indent=2) | |
resp = Response(response=array_list, | |
status=200, | |
mimetype="application/json") | |
return resp | |
except Exception, e: | |
raise e | |
@app.route('/seabedcriteria/') | |
def getSeabedCriteriaDefault(): | |
try: | |
resp_text = 'Usage Example: http://localhost/seabedcriteria/Rock<br/>' | |
resp_text = resp_text + 'Types: Rock, Sand, Mud' | |
resp = Response(response=resp_text, | |
status=500, | |
mimetype="text/html") | |
return resp | |
except Exception, e: | |
raise e |
Sorry, didn't see this until just now...
The training demo implementation only supports 'get'.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sorry for the naive question, have not seen a lick of uFrame yet.
Does http:localhost:5000/seabedcriteria support POST/GET to Create and Read?
Does http:localhost:5000/seabedcriteria/Rock support PUT/DELETE alongside GET?