progressing or not, on fakturoid
This commit is contained in:
@@ -30,7 +30,13 @@ def rower_fakturoid_auth(request):
|
||||
|
||||
@login_required()
|
||||
def rower_process_fakturoidcallback(request):
|
||||
code = request.GET['code']
|
||||
try:
|
||||
code = request.GET['code']
|
||||
except KeyError:
|
||||
error = request.GET['error']
|
||||
messages.error(request,error)
|
||||
return HttpResponseRedirect(reverse('workouts_view'))
|
||||
|
||||
post_data = {
|
||||
'code': code,
|
||||
'grant_type': 'authorization_code',
|
||||
@@ -46,13 +52,15 @@ def rower_process_fakturoidcallback(request):
|
||||
|
||||
headers = {
|
||||
'User-Agent': f"{FAKTUROID_APP_NAME} ({FAKTUROID_EMAIL})",
|
||||
'Content-Type': 'application/json',
|
||||
# 'Content-Type': 'application/json',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Basic %s' % base64.b64encode(
|
||||
bytes(auth_string, 'utf-8')).decode('utf-8'),
|
||||
}
|
||||
|
||||
base_url = 'https://app.fakturoid.cz/api/v3/oauth/token/'
|
||||
#base_url = 'https://app.fakturoid.cz/api/v3/oauth/token/'
|
||||
base_url = 'https://app.fakturoid.cz/api/v3/oauth/token'
|
||||
|
||||
response = requests.post(base_url, data=json.dumps(post_data), headers=headers)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user