Spaces:
Runtime error
Runtime error
Catching exceptions
Browse files- app.py +9 -6
- common/tinderwrapper.py +1 -1
app.py
CHANGED
@@ -31,9 +31,12 @@ if st.button('Запуск'):
|
|
31 |
status_text = st.empty()
|
32 |
wrapper = TinderWrapper(access_token)
|
33 |
create_folder(DUMP_FOLDER)
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
|
|
|
|
|
31 |
status_text = st.empty()
|
32 |
wrapper = TinderWrapper(access_token)
|
33 |
create_folder(DUMP_FOLDER)
|
34 |
+
try:
|
35 |
+
dump = wrapper.create_dump(update_progress)
|
36 |
+
save_data(dump, DUMP_FOLDER, update_progress)
|
37 |
+
shutil.make_archive('output', 'zip', DUMP_FOLDER)
|
38 |
+
update_progress(1.0, 'Обработка успешно завершена!')
|
39 |
+
with open('output.zip', 'rb') as f:
|
40 |
+
st.download_button('Скачать архив', f, file_name='output.zip')
|
41 |
+
except Exception as e:
|
42 |
+
st.error(e)
|
common/tinderwrapper.py
CHANGED
@@ -45,7 +45,7 @@ class TinderWrapper():
|
|
45 |
code, updates = self.get_updates(last_activity_date)
|
46 |
|
47 |
if not code == 200:
|
48 |
-
|
49 |
|
50 |
update_progress(0, 'Обрабатываю ответ Tinder...')
|
51 |
|
|
|
45 |
code, updates = self.get_updates(last_activity_date)
|
46 |
|
47 |
if not code == 200:
|
48 |
+
raise Exception('Неверный токен доступа!')
|
49 |
|
50 |
update_progress(0, 'Обрабатываю ответ Tinder...')
|
51 |
|