-
Notifications
You must be signed in to change notification settings - Fork 0
/
download_tags.py
55 lines (36 loc) · 1.16 KB
/
download_tags.py
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import requests
from personal_info import (
get_cookie_dict,
update_and_save_cookie_to_disk_if_values_changed,
)
from utils import get_recommender_url, get_session_id, get_steam_id
def get_recommender_tags_url(steam_id=None):
if steam_id is None:
steam_id = get_steam_id()
recommender_results_url = get_recommender_url(steam_id) + "tags"
return recommender_results_url
def get_recommender_tags_request_params():
params = {
"sessionid": get_session_id(),
}
return params
def download_recommender_tags():
url = get_recommender_tags_url()
params = get_recommender_tags_request_params()
cookies = get_cookie_dict()
response = requests.get(url, params=params, cookies=cookies)
if response.status_code == 200:
result = response.json()
jar = dict(response.cookies)
update_and_save_cookie_to_disk_if_values_changed(cookies, jar)
else:
print(
f'Download of tags failed with status code {response.status_code}.',
)
result = None
return result
def main():
result = download_recommender_tags()
return
if __name__ == '__main__':
main()