-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
c96488b
commit 0c0b65e
Showing
6 changed files
with
85 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import os | ||
from flask import Flask, jsonify | ||
from random_profile import RandomProfile | ||
|
||
# random_profile==0.2.3 required | ||
rp = RandomProfile() | ||
app = Flask(__name__) | ||
|
||
@app.route('/') | ||
def index(): | ||
return jsonify({'message': 'api is working'}) | ||
|
||
@app.route('/api/v1/random_profile') | ||
def single_profile(): | ||
profile = rp.full_profile() | ||
return jsonify({'profile': profile}) | ||
|
||
@app.route('/api/v1/random_profile/<int:num>') | ||
def multiple_profile(num): | ||
if num > 100: | ||
num = 100 | ||
profile = rp.full_profile(num) | ||
return jsonify({'profile': profile}) | ||
|
||
|
||
if __name__ == '__main__': | ||
app.run(debug=True) |
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,2 @@ | ||
random-profile==0.2.3 | ||
flask |
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 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