Update flask-api.py
Update flask-api.py

Prototype auth using static token and user/pass based in http://thecircuitnerd.com/flask-login-tokens/

Use the function  gen_auth_token(user, password) to create hash token 

Usage:

curl -H "X-Auth: admin:pass" -H "X-Auth-Token: WyJhZG1pbiIsInBhc3MiXQ.B5Xusw.6ZGpDxCdcZL7HrkHTP97aZ9dfPA" http://localhost/api/v1/gpio/17/

{
  "status": "SUCCESS",
  "pin_number": 17,
  "pin_name": "IN1",
  "value": 1,
  "error": null
}

# curl -H "X-Auth: admin:pass" -H "X-Auth-Token: wrongtoken" http://localhost/api/v1/gpio/17/
{
  "status": "ERROR",
  "error": "Auth requerided"
}


#  curl -H "X-Auth: admin:pass" http://localhost/api/v1/gpio/17/
{
  "status": "ERROR",
  "error": "Auth requerided"
}
CorrosiveKid/raspberrypi-gpio-api,Mr-Nathan/PebblePiO