fix
This commit is contained in:
@@ -53,6 +53,9 @@ oauth_data = {
|
|||||||
'scope':'read',
|
'scope':'read',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
import http.client as http_client
|
||||||
|
http_client.HTTPConnection.debuglevel = 1
|
||||||
|
|
||||||
def get_token(code,callbackuri):
|
def get_token(code,callbackuri):
|
||||||
#client_id = oauth_data['client_id']
|
#client_id = oauth_data['client_id']
|
||||||
#client_secret = oauth_data['client_secret']
|
#client_secret = oauth_data['client_secret']
|
||||||
@@ -64,17 +67,26 @@ def get_token(code,callbackuri):
|
|||||||
#print(token)
|
#print(token)
|
||||||
#return [0,0,0]
|
#return [0,0,0]
|
||||||
url = oauth_data['base_url']
|
url = oauth_data['base_url']
|
||||||
data = {"client_id": oauth_data['client_id'],
|
|
||||||
|
headers = {'Accept': 'application/json',
|
||||||
|
#'Api-Key': oauth_data['client_id'],
|
||||||
|
#'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
|
#'user-agent': 'sanderroosendaal'
|
||||||
|
}
|
||||||
|
|
||||||
|
post_data = {"client_id": oauth_data['client_id'],
|
||||||
"grant_type": "authorization_code",
|
"grant_type": "authorization_code",
|
||||||
"redirect_uri": oauth_data['redirect_uri'],
|
"redirect_uri": oauth_data['redirect_uri'],
|
||||||
"client_secret": oauth_data['client_secret'],
|
"client_secret": oauth_data['client_secret'],
|
||||||
"code": code,
|
"code": code,
|
||||||
|
#"response_type": "code",
|
||||||
# "scope":oauth_data['scope'],
|
# "scope":oauth_data['scope'],
|
||||||
}
|
}
|
||||||
#url = url+'?'+urllib.parse.urlencode(params)
|
|
||||||
print(url)
|
|
||||||
response = requests.post(url,data=data)
|
|
||||||
print(response.reason)
|
response = requests.post(url,data=json.dumps(post_data),headers=headers)
|
||||||
|
print('Status Code',response.status_code)
|
||||||
return [0,response.text,0]
|
return [0,response.text,0]
|
||||||
#return imports_get_token(code, oauth_data)
|
#return imports_get_token(code, oauth_data)
|
||||||
|
|
||||||
|
|||||||
@@ -779,8 +779,6 @@ def rower_process_nkcallback(request):
|
|||||||
uri = request.build_absolute_uri()
|
uri = request.build_absolute_uri()
|
||||||
uri = 'https://dunav.ngrok.io/'+uri[22:]
|
uri = 'https://dunav.ngrok.io/'+uri[22:]
|
||||||
print(uri)
|
print(uri)
|
||||||
print(request.GET.get('code'))
|
|
||||||
raise ValueError
|
|
||||||
|
|
||||||
# do stuff
|
# do stuff
|
||||||
try:
|
try:
|
||||||
@@ -795,7 +793,6 @@ def rower_process_nkcallback(request):
|
|||||||
|
|
||||||
uri = request.build_absolute_uri()
|
uri = request.build_absolute_uri()
|
||||||
|
|
||||||
print(res)
|
|
||||||
access_token = res[0]
|
access_token = res[0]
|
||||||
if access_token == 0:
|
if access_token == 0:
|
||||||
message = res[1]
|
message = res[1]
|
||||||
|
|||||||
Reference in New Issue
Block a user