Spaces:
Sleeping
Sleeping
DmitrMakeev
commited on
Commit
•
9368cf0
1
Parent(s):
949baaf
Update app.py
Browse files
app.py
CHANGED
@@ -7,6 +7,42 @@ app = Flask(__name__)
|
|
7 |
base_url = os.getenv('base_url') # URL сервера, например, 'https://api.notisend.ru/v1/email/'
|
8 |
token = os.getenv('token') # Ваш токен
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
@app.route('/save_db', methods=['GET'])
|
11 |
def save_db():
|
12 |
# Переменная для переключения между возвратом параметров и ответа сервера
|
|
|
7 |
base_url = os.getenv('base_url') # URL сервера, например, 'https://api.notisend.ru/v1/email/'
|
8 |
token = os.getenv('token') # Ваш токен
|
9 |
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
+
|
14 |
+
|
15 |
+
@app.route('/grups')
|
16 |
+
def grups():
|
17 |
+
return render_template('grups.html')
|
18 |
+
|
19 |
+
|
20 |
+
|
21 |
+
|
22 |
+
|
23 |
+
@app.route('/send_request', methods=['POST'])
|
24 |
+
def send_request():
|
25 |
+
api_token = request.form.get('api_token')
|
26 |
+
group_id = request.form.get('group_id')
|
27 |
+
url = f"https://api.notisend.ru/v1/email/lists/{group_id}/parameters"
|
28 |
+
headers = {
|
29 |
+
'Content-Type': 'application/json',
|
30 |
+
'Authorization': f'Bearer {api_token}'
|
31 |
+
}
|
32 |
+
response = requests.get(url, headers=headers)
|
33 |
+
data = response.json()
|
34 |
+
return jsonify(data)
|
35 |
+
|
36 |
+
|
37 |
+
|
38 |
+
|
39 |
+
|
40 |
+
|
41 |
+
|
42 |
+
|
43 |
+
|
44 |
+
|
45 |
+
|
46 |
@app.route('/save_db', methods=['GET'])
|
47 |
def save_db():
|
48 |
# Переменная для переключения между возвратом параметров и ответа сервера
|