Created
June 28, 2018 20:28
-
-
Save sergeyhush/9c28361adbd63139f624389017fb3266 to your computer and use it in GitHub Desktop.
Fake API server
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
import os | |
from flask import Flask, jsonify | |
app = Flask(__name__) | |
@app.route('/api-token-auth/', methods=['POST']) | |
def auth(): | |
# Token generated via | |
# https://jwt.io/#debugger-io?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InNlcmdleUBjdW11bHVzbmV0d29ya3MuY29tIiwibmFtZSI6IlNlcmdleSJ9.1-Tg3LW1QTgNkHrBQR2C2I3e_uiY2olfxlsFctAgwrg | |
return jsonify({ | |
'Token': | |
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InNlcmdleUBjdW11bHVzbmV0d29ya3MuY29tIiwibmFtZSI6IlNlcmdleSJ9.1-Tg3LW1QTgNkHrBQR2C2I3e_uiY2olfxlsFctAgwrg' | |
}) | |
if __name__ == '__main__': | |
app.run(port=os.environ.get('FLASK_SERVER_PORT', 8001)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment