Skip to content

Latest commit

 

History

History
39 lines (29 loc) · 789 Bytes

File metadata and controls

39 lines (29 loc) · 789 Bytes

Python API Server w/ Flask

This example sets up a basic Python API server with Flask. It uses Flask-OAuthLib to authenticate the consumer on it's first request via identitypreview.ses.nsw.gov.au. It then proxies a request to https://apipreviewbeacon.ses.nsw.gov.au/Api/v1/Users which presents the JSON blob that contains the user's record in Beacon.

Setup

  1. Pre-requisites

First, install a modern Python and virtualenv. On macOS:

brew install python3
pip install virtualenv
  1. Clone repo

  2. Install

cd ses-auth-shell/server
virtualenv venv
venv/bin/pip install Flask
venv/bin/pip install Flask-OAuthLib
  1. Run
APP_ID='myappid' APP_SECRET='mysecret' venv/bin/python3 app.py
  1. Access API with browser http://localhost:5000/

License

MIT