fix
This commit is contained in:
@@ -53,6 +53,9 @@ oauth_data = {
|
||||
'scope':'read',
|
||||
}
|
||||
|
||||
import http.client as http_client
|
||||
http_client.HTTPConnection.debuglevel = 1
|
||||
|
||||
def get_token(code,callbackuri):
|
||||
#client_id = oauth_data['client_id']
|
||||
#client_secret = oauth_data['client_secret']
|
||||
@@ -64,17 +67,26 @@ def get_token(code,callbackuri):
|
||||
#print(token)
|
||||
#return [0,0,0]
|
||||
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",
|
||||
"redirect_uri": oauth_data['redirect_uri'],
|
||||
"client_secret": oauth_data['client_secret'],
|
||||
"code": code,
|
||||
#"response_type": "code",
|
||||
# "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 imports_get_token(code, oauth_data)
|
||||
|
||||
|
||||
@@ -779,8 +779,6 @@ def rower_process_nkcallback(request):
|
||||
uri = request.build_absolute_uri()
|
||||
uri = 'https://dunav.ngrok.io/'+uri[22:]
|
||||
print(uri)
|
||||
print(request.GET.get('code'))
|
||||
raise ValueError
|
||||
|
||||
# do stuff
|
||||
try:
|
||||
@@ -795,7 +793,6 @@ def rower_process_nkcallback(request):
|
||||
|
||||
uri = request.build_absolute_uri()
|
||||
|
||||
print(res)
|
||||
access_token = res[0]
|
||||
if access_token == 0:
|
||||
message = res[1]
|
||||
|
||||
Reference in New Issue
Block a user