Skip to content
This repository was archived by the owner on Mar 27, 2023. It is now read-only.

Commit 71d1fb1

Browse files
committed
fixed flake8
1 parent 19a7526 commit 71d1fb1

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed

backend/accounts/utils/social/oauth.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import json
21
import os
32
from urllib import parse
43

5-
from core import constants as c
6-
74
import requests
85

6+
from core import constants as c
7+
98

109
def get_payload(backend, code):
1110

@@ -16,22 +15,21 @@ def get_payload(backend, code):
1615
client_id = os.environ.get(key, "nokey")
1716
client_secret = os.environ.get(secret, "nosecret")
1817

19-
2018
if backend == 'github':
2119
payload = {
22-
'code': code,
23-
'client_id': client_id,
24-
'client_secret': client_secret,
25-
}
20+
'code': code,
21+
'client_id': client_id,
22+
'client_secret': client_secret,
23+
}
2624

2725
elif backend == 'google-oauth2':
2826
payload = {
29-
'code': code,
30-
'client_id': client_id,
31-
'client_secret': client_secret,
32-
'redirect_uri': "http://localhost/auth/google-oauth2/callback",
33-
'grant_type': "authorization_code"
34-
}
27+
'code': code,
28+
'client_id': client_id,
29+
'client_secret': client_secret,
30+
'redirect_uri': "http://localhost/auth/google-oauth2/callback",
31+
'grant_type': "authorization_code"
32+
}
3533

3634
return payload
3735

@@ -59,7 +57,6 @@ def get_access_token_from_code(backend, code):
5957

6058
return params["b'access_token"]
6159

62-
6360
# google returns this:
6461
# {
6562
# 'access_token': 'ya29.frejf8erf.erferfeg.erfeogOS9tzAPQlNlUXitkMbmSt',

backend/core/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
OAUTH = {
55
'github': {
66
'name': 'github',
7-
'url':'https://github.com/login/oauth/access_token'
7+
'url': 'https://github.com/login/oauth/access_token'
88
},
99
'google-oauth2': {
1010
'name': 'google-oauth2',
11-
'url':'https://oauth2.googleapis.com/token'
11+
'url': 'https://oauth2.googleapis.com/token'
1212
}
1313
}

0 commit comments

Comments
 (0)