vtrv.vls commited on
Commit
766dff5
1 Parent(s): 623a39b
Files changed (1) hide show
  1. utils.py +5 -3
utils.py CHANGED
@@ -4,7 +4,7 @@ import os
4
  from datetime import datetime, timedelta
5
 
6
 
7
- def gen_auth_token():
8
  url = "https://ngw.devices.sberbank.ru:9443/api/v2/oauth"
9
 
10
  payload='scope=GIGACHAT_API_CORP'
@@ -17,7 +17,7 @@ def gen_auth_token():
17
 
18
  response = requests.request("POST", url, headers=headers, data=payload, verify=False)
19
 
20
- with open('auth_token.json', 'w') as f:
21
  json.dump(json.loads(response.text), f, ensure_ascii=False)
22
 
23
 
@@ -52,8 +52,10 @@ def get_text(content='Привет!', auth_token=None):
52
 
53
  def generate(content='Привет!', auth_file=None):
54
  if auth_file is None or not os.path.isfile(auth_file):
55
- gen_auth_token()
56
 
 
 
57
  with open(auth_file) as f:
58
  auth_token = json.load(f)
59
 
 
4
  from datetime import datetime, timedelta
5
 
6
 
7
+ def gen_auth_token(auth_file):
8
  url = "https://ngw.devices.sberbank.ru:9443/api/v2/oauth"
9
 
10
  payload='scope=GIGACHAT_API_CORP'
 
17
 
18
  response = requests.request("POST", url, headers=headers, data=payload, verify=False)
19
 
20
+ with open(auth_file, 'w') as f:
21
  json.dump(json.loads(response.text), f, ensure_ascii=False)
22
 
23
 
 
52
 
53
  def generate(content='Привет!', auth_file=None):
54
  if auth_file is None or not os.path.isfile(auth_file):
55
+ gen_auth_token(auth_file)
56
 
57
+ print(os.listdir())
58
+
59
  with open(auth_file) as f:
60
  auth_token = json.load(f)
61