-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
api/discoverer refactor: tests passing with (discoverer requires a li…
…veserver)
- Loading branch information
Showing
16 changed files
with
348 additions
and
268 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
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
Binary file not shown.
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 @@ | ||
from utils import discover |
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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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 @@ | ||
from app import * |
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,93 @@ | ||
from flask import Flask, jsonify, request | ||
|
||
class Stubdata: | ||
|
||
resources_route = { | ||
"/GET": { | ||
"description": "desc for resc1", | ||
"methods": [ | ||
"GET" | ||
], | ||
"scopes": [], | ||
"rate_limit": [1000,60*60*24], | ||
}, | ||
"/POST": { | ||
"description": "desc for resc2", | ||
"methods": [ | ||
"POST" | ||
], | ||
"scopes": [], | ||
"rate_limit": [1000,60*60*24], | ||
|
||
}, | ||
"/GETPOST": { | ||
"description": "desc for resc3", | ||
"methods": [ | ||
"GET", | ||
"POST", | ||
], | ||
"scopes": [], | ||
"rate_limit": [1000,60*60*24], | ||
|
||
}, | ||
"/SCOPED": { | ||
"description": "desc for resc3", | ||
"methods": [ | ||
"GET", | ||
], | ||
"scopes": ['this-scope-shouldnt-exist'], | ||
"rate_limit": [1000,60*60*24], | ||
|
||
}, | ||
"/resources": { | ||
"description": "Overview of available resources", | ||
"methods": [ | ||
"GET" | ||
], | ||
"scopes": [], | ||
"rate_limit": [1000,60*60*24], | ||
} | ||
} | ||
|
||
GET = {'resource': 'GET'} | ||
POST = {'resource': 'POST'} | ||
GETPOST = { | ||
'GET': {'resource': 'GETPOST','method':'get'}, | ||
'POST': {'resource': 'GETPOST','method':'post'}, | ||
} | ||
|
||
|
||
|
||
|
||
def create_app(): | ||
app = Flask(__name__) | ||
|
||
@app.route('/resources') | ||
def resources(): | ||
return jsonify(Stubdata.resources_route) | ||
|
||
@app.route('/GET',methods=['GET']) | ||
def get_(): | ||
return jsonify(Stubdata.GET) | ||
|
||
@app.route('/POST',methods=['POST']) | ||
def post_(): | ||
return jsonify(Stubdata.POST) | ||
|
||
@app.route('/GETPOST',methods=['GET','POST']) | ||
def getpost(): | ||
if request.method=='GET': | ||
return jsonify(Stubdata.GETPOST['GET']) | ||
if request.method=='POST': | ||
return jsonify(Stubdata.GETPOST['POST']) | ||
|
||
return app | ||
|
||
|
||
|
||
def run(): | ||
app = create_app() | ||
app.run(host='127.0.0.1',port=5005,processes=5,debug=False) | ||
|
||
if __name__ == "__main__": | ||
run() |
Oops, something went wrong.