Spaces:
Sleeping
Sleeping
CaesarCloudSync
commited on
Commit
•
77b3c51
1
Parent(s):
130fc9d
CaesarFinance setup code implemented
Browse files
CaesarFinance/caesarfinance.py
CHANGED
@@ -18,17 +18,15 @@ class CaesarFinance:
|
|
18 |
|
19 |
def fetch_access_code(self):
|
20 |
resp = requests.get("https://palondomus-caesarai.hf.space/caesaraigetcode")
|
21 |
-
return resp.json()
|
22 |
def get_access_token(self,code):
|
23 |
-
|
24 |
-
form_data = {'grant_type': 'value','client_id':self.CLIENT_ID,'client_secret':self.CLIENT_SECRET,
|
25 |
"redirect_uri":"https://palondomus-caesarai.hf.space",
|
26 |
"code":code
|
27 |
}
|
28 |
-
server = requests.post(
|
29 |
-
output = server.
|
30 |
-
|
31 |
-
print('The response from the server is: \n', output)
|
32 |
|
33 |
if __name__ == "__main__":
|
34 |
caesarfinance = CaesarFinance()
|
@@ -36,8 +34,9 @@ if __name__ == "__main__":
|
|
36 |
while access_code_bool == False:
|
37 |
access_code_bool = caesarfinance.create_access_code()
|
38 |
|
39 |
-
|
40 |
-
print()
|
41 |
code = caesarfinance.fetch_access_code()
|
|
|
|
|
|
|
42 |
|
43 |
#caesarfinance.get_access_code()
|
|
|
18 |
|
19 |
def fetch_access_code(self):
|
20 |
resp = requests.get("https://palondomus-caesarai.hf.space/caesaraigetcode")
|
21 |
+
return resp.json()["messagecode"]
|
22 |
def get_access_token(self,code):
|
23 |
+
form_data = {'grant_type': 'authorization_code','client_id':self.CLIENT_ID,'client_secret':self.CLIENT_SECRET,
|
|
|
24 |
"redirect_uri":"https://palondomus-caesarai.hf.space",
|
25 |
"code":code
|
26 |
}
|
27 |
+
server = requests.post('https://api.monzo.com/oauth2/token', data=form_data)
|
28 |
+
output = server.json()["access_token"]
|
29 |
+
return output
|
|
|
30 |
|
31 |
if __name__ == "__main__":
|
32 |
caesarfinance = CaesarFinance()
|
|
|
34 |
while access_code_bool == False:
|
35 |
access_code_bool = caesarfinance.create_access_code()
|
36 |
|
|
|
|
|
37 |
code = caesarfinance.fetch_access_code()
|
38 |
+
access_token = caesarfinance.get_access_token(code)
|
39 |
+
print(access_token)
|
40 |
+
|
41 |
|
42 |
#caesarfinance.get_access_code()
|