-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.py
More file actions
30 lines (22 loc) · 843 Bytes
/
Copy pathutils.py
File metadata and controls
30 lines (22 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import validators
from validators import ValidationFailure
def is_string_an_url(url_string: str) -> bool:
result = validators.url(url_string)
if isinstance(result, ValidationFailure):
return False
return result
def update_white_list(chat_ids):
with open('config/whitelist.txt', 'w') as filehandler:
for chatid in chat_ids:
filehandler.write('%s\n' % chatid)
filehandler.close()
def update_black_list(banned_list):
with open('config/blacklist.txt', 'w') as filehandler:
for chatid in banned_list:
filehandler.write('%s\n' % chatid)
filehandler.close()
def update_downloads_log(downloads_log):
with open('config/downloads_log.txt', 'w') as filehandler:
for item in downloads_log:
filehandler.write('%s\n' % item)
filehandler.close()