Spaces:
Sleeping
Sleeping
DmitrMakeev
commited on
Commit
•
2123df3
1
Parent(s):
45453fb
Update google_db.py
Browse files- google_db.py +5 -7
google_db.py
CHANGED
@@ -7,6 +7,9 @@ import aiohttp
|
|
7 |
api_variabl = os.getenv('api_key')
|
8 |
google_url = os.getenv('goo_url')
|
9 |
|
|
|
|
|
|
|
10 |
async def async_save_db(data):
|
11 |
async with aiohttp.ClientSession() as session:
|
12 |
async with session.post(google_url, data=data, headers={'Content-Type': 'application/x-www-form-urlencoded'}) as response:
|
@@ -16,7 +19,7 @@ async def async_save_db(data):
|
|
16 |
else:
|
17 |
return False
|
18 |
|
19 |
-
def save_db():
|
20 |
err = 0
|
21 |
|
22 |
if api_variabl == request.args.get('api'):
|
@@ -45,9 +48,4 @@ def save_db():
|
|
45 |
"err": err
|
46 |
}
|
47 |
|
48 |
-
return jsonify(response_data)
|
49 |
-
|
50 |
-
@app.route("/save_db", methods=['GET'])
|
51 |
-
def handle_save_db():
|
52 |
-
response = save_db()
|
53 |
-
return response
|
|
|
7 |
api_variabl = os.getenv('api_key')
|
8 |
google_url = os.getenv('goo_url')
|
9 |
|
10 |
+
api_variabl = os.getenv('api_key')
|
11 |
+
google_url = os.getenv('goo_url')
|
12 |
+
|
13 |
async def async_save_db(data):
|
14 |
async with aiohttp.ClientSession() as session:
|
15 |
async with session.post(google_url, data=data, headers={'Content-Type': 'application/x-www-form-urlencoded'}) as response:
|
|
|
19 |
else:
|
20 |
return False
|
21 |
|
22 |
+
def save_db(app):
|
23 |
err = 0
|
24 |
|
25 |
if api_variabl == request.args.get('api'):
|
|
|
48 |
"err": err
|
49 |
}
|
50 |
|
51 |
+
return jsonify(response_data)
|
|
|
|
|
|
|
|
|
|