@AdrianSamuel/

Testing AUTH

Python

No description

fork
loading
Files
  • main.py
  • requirements.txt
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import requests
import json

# URL use to authenticate user: https://cloud.lightspeedapp.com/oauth/authorize.php?response_type=code&client_id={client_id}&scope=employee:all

url = 'https://cloud.lightspeedapp.com/oauth/access_token.php'

# fill in payload here
payload = {
  'client_id': '',
  'client_secret':'',
  'code':'',
  "grant_type":'authorization_code'

}
headers = {'content-type': 'application/json'}

r = requests.request('POST', url, data=json.dumps(payload), headers=headers)

#Logs credentials to the virtual console
print(r.json())
data = r.json()

# creates credentials file with json response  
with open('credentials.json', 'a') as outfile:  
    json.dump(data, outfile, indent=4)