progressing or not, on fakturoid
This commit is contained in:
@@ -30,7 +30,13 @@ def rower_fakturoid_auth(request):
|
|||||||
|
|
||||||
@login_required()
|
@login_required()
|
||||||
def rower_process_fakturoidcallback(request):
|
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 = {
|
post_data = {
|
||||||
'code': code,
|
'code': code,
|
||||||
'grant_type': 'authorization_code',
|
'grant_type': 'authorization_code',
|
||||||
@@ -46,13 +52,15 @@ def rower_process_fakturoidcallback(request):
|
|||||||
|
|
||||||
headers = {
|
headers = {
|
||||||
'User-Agent': f"{FAKTUROID_APP_NAME} ({FAKTUROID_EMAIL})",
|
'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',
|
'Accept': 'application/json',
|
||||||
'Authorization': 'Basic %s' % base64.b64encode(
|
'Authorization': 'Basic %s' % base64.b64encode(
|
||||||
bytes(auth_string, 'utf-8')).decode('utf-8'),
|
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)
|
response = requests.post(base_url, data=json.dumps(post_data), headers=headers)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user