Private
Public Access
1
0

added headers key to oauth_settings

This commit is contained in:
Sander Roosendaal
2018-08-15 10:43:21 +02:00
parent 1e23354346
commit 2374b1b0bc
2 changed files with 10 additions and 9 deletions

View File

@@ -177,6 +177,7 @@ def imports_get_token(
client_id,client_secret
)
post_data = {"grant_type": "authorization_code",
"code": code,
"redirect_uri": redirect_uri,
@@ -184,12 +185,14 @@ def imports_get_token(
"client_id": client_id,
}
headers = {'Accept': 'application/json',
'Api-Key': client_id,
'Content-Type': 'application/json',
'user-agent': 'sanderroosendaal'}
try:
headers = oauth_data['headers']
except KeyError:
headers = {'Accept': 'application/json',
'Api-Key': client_id,
'Content-Type': 'application/json',
'user-agent': 'sanderroosendaal'}
if 'json' in oauth_data['content_type']:
response = requests.post(
base_uri,
@@ -201,9 +204,6 @@ def imports_get_token(
data=post_data,
headers=headers)
print response.status_code
print response.json()
if response.status_code == 200 or response.status_code == 201:
token_json = response.json()
try: