DmitrMakeev commited on
Commit
98142db
·
verified ·
1 Parent(s): c30f968

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py CHANGED
@@ -247,7 +247,26 @@ def initialize_requests():
247
 
248
 
249
 
 
 
 
250
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
251
 
252
 
253
 
 
247
 
248
 
249
 
250
+ @app.route('/api/group/<int:group_id>', methods=['GET'])
251
+ def get_group_info(group_id):
252
+ api_token = request.args.get('apiToken')
253
 
254
+ if not api_token:
255
+ return jsonify({'error': 'API Token is required'}), 400
256
+
257
+ url = f'https://api.notisend.ru/v1/email/lists/{group_id}'
258
+ headers = {
259
+ 'Content-Type': 'application/json',
260
+ 'Authorization': f'Bearer {api_token}'
261
+ }
262
+
263
+ try:
264
+ response = requests.get(url, headers=headers)
265
+ response.raise_for_status()
266
+ data = response.json()
267
+ return jsonify(data)
268
+ except requests.RequestException as e:
269
+ return jsonify({'error': str(e)}), 500
270
 
271
 
272