Skip to content

Instantly share code, notes, and snippets.

@sergeyhush
Created June 28, 2018 20:28
Show Gist options
  • Save sergeyhush/9c28361adbd63139f624389017fb3266 to your computer and use it in GitHub Desktop.
Save sergeyhush/9c28361adbd63139f624389017fb3266 to your computer and use it in GitHub Desktop.
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