Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Fake API server
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