-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathOAuth.py
More file actions
35 lines (27 loc) · 789 Bytes
/
OAuth.py
File metadata and controls
35 lines (27 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""
eBest Open API / OAuth
2023.07.11
"""
import pprint
import requests
import Key
APP_KEY = Key.MOCK_KEY
APP_SECRET = Key.MOCK_SECRET
header = {
"content-type" : "application/x-www-form-urlencoded"
}
param = {
"grant_type" : "client_credentials",
"appkey" : APP_KEY,
"appsecretkey" : APP_SECRET,
"scope" : "oob"
}
PATH = "oauth2/token"
URL_BASE = "https://openapi.ebestsec.co.kr:8080"
URL = f"{URL_BASE}/{PATH}"
res = requests.post(URL, headers=header, params=param, timeout=1)
ACCESS_TOKEN = res.json()["access_token"]
if __name__ == "__main__":
print("URL : ", URL, "\n") # Ok
print("OAuth : ")
pprint.pprint(res.json()) # Ok