hltv-async-api 0.2.6__tar.gz → 0.2.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,186 @@
1
+ Metadata-Version: 2.1
2
+ Name: hltv_async_api
3
+ Version: 0.2.8
4
+ Summary: Hltv-aio An unofficial asynchronous HLTV API Wrapper for Python
5
+ Home-page: https://github.com/akimerslys/aiohltv
6
+ Author: akimerslys
7
+ Author-email: Akim Slys <akimslys2003@gmail.com>
8
+ Project-URL: Homepage, https://github.com/akimerslys/aiohltv
9
+ Project-URL: Issues, https://github.com/akimerslys/aiohltv/issues
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Requires-Python: >=3.9
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+
17
+ # hltv-async-api an unofficial asynchronous HLTV API Wrapper for Python
18
+
19
+ # Features
20
+
21
+ * New and modern fully async library
22
+
23
+ * Supports proxy usage for rate-limiting and privacy
24
+
25
+ * Automatically changes proxy if access is denied
26
+
27
+
28
+ ---
29
+
30
+ # Installation
31
+
32
+ ```
33
+ pip install hltv-async-api
34
+ ```
35
+
36
+ ---
37
+
38
+
39
+ # Simple Usage
40
+
41
+ ```
42
+ from hltv_async_api import Hltv
43
+
44
+ hltv = Hltv()
45
+ live_matches = await hltv.get_live_matches()
46
+ ```
47
+
48
+ ---
49
+
50
+ # Proxy Usage
51
+
52
+ **Load Proxies from list**
53
+
54
+ ```
55
+ proxy_list = ['http://120.234.203.171:9002', 'http://110.38.68.38:80']
56
+
57
+ hltv = Hltv(use_proxy=True, proxy_list=proxy_list)
58
+ ```
59
+
60
+ **Load Proxies from file**
61
+
62
+ ```
63
+ hltv = Hltv(use_proxy=True, proxy_path='PATH_TO_PROXY.TXT')
64
+ ```
65
+
66
+
67
+ **Remove bad proxy from file**
68
+
69
+ ```
70
+ hltv = Hltv(use_proxy=True, proxy_path='PATH_TO_PROXY.TXT', remove_proxy=True)
71
+ ```
72
+
73
+ **Add proxy protocol**
74
+
75
+ ```
76
+ proxy_list = ['120.234.203.171:9002', '110.38.68.38:80']
77
+
78
+ hltv = Hltv(use_proxy=True, proxy_list=proxy_list, proxy_protocol='http')
79
+ ```
80
+
81
+ ---
82
+ # Methods
83
+ * get_upcoming_matches(days: int = 7, min_star_rating: int = 1)
84
+
85
+ -days (the number of days into the future to fetch matches for)
86
+
87
+ -min_star_rating (the minimum star rating for matches to include)
88
+
89
+ ```
90
+ await hltv.get_upcoming_matches(1, 5)
91
+
92
+ >>> ['date': '11/11/2024', 'matches': [team1: 'Natus Vincere' | 'TBD', team2: 'FaZe' | 'TBD', time: '14:15', maps: '3', stars: 5, 'PGL CS2 Major Copenhagen 2024' | None]]```
93
+
94
+ ```
95
+
96
+ * get_event_results(event_id: int | str)
97
+
98
+
99
+ ```
100
+ await get_event_results(7148)
101
+
102
+ >>> ['date': '31-3', 'team1': 'FaZe', 'team2': 'Natus Vincere', 'score1': '1', 'score2': '2']
103
+
104
+ ```
105
+
106
+ * get_event_matches(event_id: str | int):
107
+
108
+ ```
109
+ await hltv.get_event_matches(7148)
110
+
111
+ >>>['team1': 'Natus Vincere', 'team2': 'FaZe', 'date': '11-11' | 'LIVE']
112
+ ```
113
+
114
+ * get_event_info(event_id: str | int, event_title: str) -> (event_id, event_title, event_start, event_end, prize, team_num, location, groups)
115
+
116
+ ```
117
+ await hltv.get_event_info(7148, 'PGL CS2 Major Copenhagen2024')
118
+
119
+ (7148, 'PGL CS2 Major Copenhagen2024', '21-3', '31-3', '$1,250,000', '16', 'Copenhagen, Denmark', [])
120
+ ```
121
+
122
+
123
+ get_top_teams(max_teams=30) -> ['rank', 'title', 'points', 'change', 'id']
124
+
125
+ ```
126
+ await hltv.get_top_teams(2)
127
+
128
+ >>>[{'rank': '1', 'title': 'FaZe', 'points': '939', 'change': '-', 'id': '6667'}, {'rank': '2', 'title': 'Natus Vincere', 'points': '757', 'change': '+4', 'id': '4608'}]
129
+ ```
130
+
131
+ get_team_info(team_id: int | str, title: str) -> (team_id, team_title, rank, [players], coach, average_age, weeks_in_top_20, last_trophy, total_trophys)
132
+
133
+ ```
134
+ await hltv.get_team_info(6667, 'faze')
135
+
136
+ >>>(6667, 'faze', '1', ['karrigan', 'rain', 'frozen', 'ropz', 'broky'], 'NEO', '26.5', '256', 'CS Asia Championships 2023', 21)
137
+ ```
138
+
139
+ get_last_news(self, max_reg_news=2, only_today=True, only_featured=False) -> [date, [featured_id, featured_title, featured_desciption], [regular_id, reg_title, reg_time]]
140
+
141
+ ```
142
+ await hltv.get_last_news(only_today=True, max_reg_news=1)
143
+
144
+ >>>[{'date': '02-04', 'f_news': [{'f_id': '38682', 'f_title': 'NIP confirm r1nkle signing', 'f_desc': "Ninjas in Pyjamas only have an anchor player left to sign following the young Ukrainian AWPer's addition."}], 'news': [{'id': '38685', 'title': 'Rounds add sLowi, p3kko', 'posted': 'an hour ago'}, {'id': '38690', 'title': 'n1ssim returns to Sharks after paiN loan deal expires', 'posted': 'an hour ago'}]}]
145
+ ```
146
+ ---
147
+ # Examples
148
+
149
+ ****Simple Example****
150
+
151
+ ```
152
+ from hltv_async_api import Hltv
153
+
154
+
155
+ async def test():
156
+
157
+ hltv = Hltv()
158
+
159
+ print(await hltv.get_event_info(7148, 'pgl-cs2-major-copenhagen-2024'))
160
+
161
+ if __name__ == "__main__":
162
+ asyncio.run(test())
163
+ ```
164
+
165
+ ****Proxy Parser****
166
+ ```
167
+ from hltv_async_api import Hltv
168
+
169
+
170
+ async def test():
171
+
172
+ hltv = Hltv(debug=True, use_proxy=True, proxy_path='proxy_test.txt', timeout=1, remove_proxy=True, proxy_protocol='http')
173
+
174
+ print(await hltv.get_event_info(7148, 'pgl-cs2-major-copenhagen-2024'))
175
+
176
+ if __name__ == "__main__":
177
+ asyncio.run(test())
178
+ ```
179
+
180
+
181
+ # Requirements:
182
+
183
+ Python 3.9+
184
+
185
+ License:
186
+ HLTV Async is licensed under the MIT License, allowing for personal and commercial use with minimal restrictions.
@@ -0,0 +1,170 @@
1
+ # hltv-async-api an unofficial asynchronous HLTV API Wrapper for Python
2
+
3
+ # Features
4
+
5
+ * New and modern fully async library
6
+
7
+ * Supports proxy usage for rate-limiting and privacy
8
+
9
+ * Automatically changes proxy if access is denied
10
+
11
+
12
+ ---
13
+
14
+ # Installation
15
+
16
+ ```
17
+ pip install hltv-async-api
18
+ ```
19
+
20
+ ---
21
+
22
+
23
+ # Simple Usage
24
+
25
+ ```
26
+ from hltv_async_api import Hltv
27
+
28
+ hltv = Hltv()
29
+ live_matches = await hltv.get_live_matches()
30
+ ```
31
+
32
+ ---
33
+
34
+ # Proxy Usage
35
+
36
+ **Load Proxies from list**
37
+
38
+ ```
39
+ proxy_list = ['http://120.234.203.171:9002', 'http://110.38.68.38:80']
40
+
41
+ hltv = Hltv(use_proxy=True, proxy_list=proxy_list)
42
+ ```
43
+
44
+ **Load Proxies from file**
45
+
46
+ ```
47
+ hltv = Hltv(use_proxy=True, proxy_path='PATH_TO_PROXY.TXT')
48
+ ```
49
+
50
+
51
+ **Remove bad proxy from file**
52
+
53
+ ```
54
+ hltv = Hltv(use_proxy=True, proxy_path='PATH_TO_PROXY.TXT', remove_proxy=True)
55
+ ```
56
+
57
+ **Add proxy protocol**
58
+
59
+ ```
60
+ proxy_list = ['120.234.203.171:9002', '110.38.68.38:80']
61
+
62
+ hltv = Hltv(use_proxy=True, proxy_list=proxy_list, proxy_protocol='http')
63
+ ```
64
+
65
+ ---
66
+ # Methods
67
+ * get_upcoming_matches(days: int = 7, min_star_rating: int = 1)
68
+
69
+ -days (the number of days into the future to fetch matches for)
70
+
71
+ -min_star_rating (the minimum star rating for matches to include)
72
+
73
+ ```
74
+ await hltv.get_upcoming_matches(1, 5)
75
+
76
+ >>> ['date': '11/11/2024', 'matches': [team1: 'Natus Vincere' | 'TBD', team2: 'FaZe' | 'TBD', time: '14:15', maps: '3', stars: 5, 'PGL CS2 Major Copenhagen 2024' | None]]```
77
+
78
+ ```
79
+
80
+ * get_event_results(event_id: int | str)
81
+
82
+
83
+ ```
84
+ await get_event_results(7148)
85
+
86
+ >>> ['date': '31-3', 'team1': 'FaZe', 'team2': 'Natus Vincere', 'score1': '1', 'score2': '2']
87
+
88
+ ```
89
+
90
+ * get_event_matches(event_id: str | int):
91
+
92
+ ```
93
+ await hltv.get_event_matches(7148)
94
+
95
+ >>>['team1': 'Natus Vincere', 'team2': 'FaZe', 'date': '11-11' | 'LIVE']
96
+ ```
97
+
98
+ * get_event_info(event_id: str | int, event_title: str) -> (event_id, event_title, event_start, event_end, prize, team_num, location, groups)
99
+
100
+ ```
101
+ await hltv.get_event_info(7148, 'PGL CS2 Major Copenhagen2024')
102
+
103
+ (7148, 'PGL CS2 Major Copenhagen2024', '21-3', '31-3', '$1,250,000', '16', 'Copenhagen, Denmark', [])
104
+ ```
105
+
106
+
107
+ get_top_teams(max_teams=30) -> ['rank', 'title', 'points', 'change', 'id']
108
+
109
+ ```
110
+ await hltv.get_top_teams(2)
111
+
112
+ >>>[{'rank': '1', 'title': 'FaZe', 'points': '939', 'change': '-', 'id': '6667'}, {'rank': '2', 'title': 'Natus Vincere', 'points': '757', 'change': '+4', 'id': '4608'}]
113
+ ```
114
+
115
+ get_team_info(team_id: int | str, title: str) -> (team_id, team_title, rank, [players], coach, average_age, weeks_in_top_20, last_trophy, total_trophys)
116
+
117
+ ```
118
+ await hltv.get_team_info(6667, 'faze')
119
+
120
+ >>>(6667, 'faze', '1', ['karrigan', 'rain', 'frozen', 'ropz', 'broky'], 'NEO', '26.5', '256', 'CS Asia Championships 2023', 21)
121
+ ```
122
+
123
+ get_last_news(self, max_reg_news=2, only_today=True, only_featured=False) -> [date, [featured_id, featured_title, featured_desciption], [regular_id, reg_title, reg_time]]
124
+
125
+ ```
126
+ await hltv.get_last_news(only_today=True, max_reg_news=1)
127
+
128
+ >>>[{'date': '02-04', 'f_news': [{'f_id': '38682', 'f_title': 'NIP confirm r1nkle signing', 'f_desc': "Ninjas in Pyjamas only have an anchor player left to sign following the young Ukrainian AWPer's addition."}], 'news': [{'id': '38685', 'title': 'Rounds add sLowi, p3kko', 'posted': 'an hour ago'}, {'id': '38690', 'title': 'n1ssim returns to Sharks after paiN loan deal expires', 'posted': 'an hour ago'}]}]
129
+ ```
130
+ ---
131
+ # Examples
132
+
133
+ ****Simple Example****
134
+
135
+ ```
136
+ from hltv_async_api import Hltv
137
+
138
+
139
+ async def test():
140
+
141
+ hltv = Hltv()
142
+
143
+ print(await hltv.get_event_info(7148, 'pgl-cs2-major-copenhagen-2024'))
144
+
145
+ if __name__ == "__main__":
146
+ asyncio.run(test())
147
+ ```
148
+
149
+ ****Proxy Parser****
150
+ ```
151
+ from hltv_async_api import Hltv
152
+
153
+
154
+ async def test():
155
+
156
+ hltv = Hltv(debug=True, use_proxy=True, proxy_path='proxy_test.txt', timeout=1, remove_proxy=True, proxy_protocol='http')
157
+
158
+ print(await hltv.get_event_info(7148, 'pgl-cs2-major-copenhagen-2024'))
159
+
160
+ if __name__ == "__main__":
161
+ asyncio.run(test())
162
+ ```
163
+
164
+
165
+ # Requirements:
166
+
167
+ Python 3.9+
168
+
169
+ License:
170
+ HLTV Async is licensed under the MIT License, allowing for personal and commercial use with minimal restrictions.
@@ -6,4 +6,4 @@
6
6
  from .aiohltv import Hltv
7
7
 
8
8
  __author__ = 'akimerslys'
9
- __version__ = '0.2.6'
9
+ __version__ = '0.2.8'
@@ -1,6 +1,7 @@
1
1
  from typing import Any, List
2
2
  from datetime import date, datetime, timedelta
3
-
3
+ import pytz
4
+ import aiofiles
4
5
  from bs4 import BeautifulSoup
5
6
  import asyncio
6
7
  from asyncio import get_running_loop
@@ -75,11 +76,11 @@ class Hltv:
75
76
  self.DEBUG = debug
76
77
  self._configure_logging()
77
78
 
78
- def get_proxy(self):
79
+ async def get_proxy(self):
79
80
  proxy = ''
80
81
  if self.PROXY_PATH:
81
- with open(self.PROXY_PATH, "r") as file:
82
- new_proxy = file.readline().strip()
82
+ async with aiofiles.open(self.PROXY_PATH, "r") as file:
83
+ new_proxy = await file.readline().strip()
83
84
  if new_proxy:
84
85
  proxy = new_proxy
85
86
 
@@ -87,7 +88,7 @@ class Hltv:
87
88
  proxy = self.PROXY_LIST[0]
88
89
 
89
90
  if self.PROXY_PROTOCOL and proxy != '' and self.PROXY_PROTOCOL not in proxy:
90
- proxy = self.PROXY_PROTOCOL + '://' + proxy
91
+ proxy = self.PROXY_PROTOCOL + '://' + proxy
91
92
 
92
93
  return proxy
93
94
 
@@ -95,14 +96,14 @@ class Hltv:
95
96
  if self.PROXY_PATH:
96
97
  if self.PROXY_PROTOCOL:
97
98
  proxy = proxy.replace(self.PROXY_PROTOCOL + '://', '')
98
- with open(self.PROXY_PATH, "r+") as file:
99
- proxies = file.readlines()
100
- file.seek(0)
99
+ async with aiofiles.open(self.PROXY_PATH, "r+") as file:
100
+ proxies = await file.readlines()
101
+ await file.seek(0)
101
102
  for line in proxies:
102
103
  if line.strip() != proxy:
103
- file.write(line)
104
+ await file.write(line)
104
105
  if not self.REMOVE_PROXY:
105
- file.write(proxy + "\n")
106
+ await file.write(proxy + "\n")
106
107
  else:
107
108
  self.PROXY_LIST = self.PROXY_LIST[1:] + [self.PROXY_LIST[0]]
108
109
 
@@ -122,7 +123,7 @@ class Hltv:
122
123
  if self.USE_PROXY:
123
124
  self.logger.debug(f"Switching proxy {proxy}")
124
125
  await self.switch_proxy(proxy)
125
- self.logger.info(f"New proxy: {self.get_proxy()}")
126
+ self.logger.info(f"New proxy: {await self.get_proxy()}")
126
127
  else:
127
128
  if delay < self.MAX_DELAY:
128
129
  delay += 1
@@ -136,7 +137,7 @@ class Hltv:
136
137
  proxy = ''
137
138
  # setup new proxy, cuz old one was switched
138
139
  if self.USE_PROXY:
139
- proxy = self.get_proxy()
140
+ proxy = await self.get_proxy()
140
141
  else:
141
142
  # delay, only for non proxy users. (default = 1-15s)
142
143
  await asyncio.sleep(delay)
@@ -221,7 +222,7 @@ class Hltv:
221
222
  matches = []
222
223
  try:
223
224
 
224
- days = 7
225
+
225
226
  for i, date_div in enumerate(r.find_all('div', {'class': 'upcomingMatchesSection'}), start=1):
226
227
  if i > days:
227
228
  break
@@ -578,7 +579,7 @@ class Hltv:
578
579
  except AttributeError:
579
580
  pass
580
581
 
581
- return (team_id, title, rank, players, coach, age, weeks, last_trophy, total_trophys)
582
+ return team_id, title, rank, players, coach, age, weeks, last_trophy, total_trophys
582
583
  except AttributeError:
583
584
  raise AttributeError("Parsing error, probably page not fully loaded")
584
585
 
@@ -628,18 +629,68 @@ class Hltv:
628
629
  if rank > top:
629
630
  break
630
631
  except AttributeError:
631
- raise AttributeError("Parsing error, probably page not fully loaded")
632
+ raise AttributeError("Top players parsing error, probably page not fully loaded")
632
633
 
633
634
  return players
634
635
 
635
- # TODO WRITE
636
- async def get_last_news(self):
637
- return []
636
+ async def get_last_news(self, max_reg_news=2, only_today=True, only_featured=False):
637
+ r = await self.fetch('https://www.hltv.org/')
638
+
639
+ today = datetime.now(tz=pytz.timezone('Europe/Copenhagen'))
640
+ article_days = {
641
+ 1: today.strftime('%d-%m'),
642
+ 2: (today - timedelta(days=1)).strftime('%d-%m'),
643
+ 3: 'old'
644
+ }
645
+
646
+ news = []
647
+ reg_news_num = 0
648
+ for i, news_date_div in enumerate(r.find_all('div', {'class', 'standard-box standard-list'}), start=1):
649
+ date_ = article_days[i]
650
+ f_news = []
651
+ reg_news = []
652
+ for featured_news_div in news_date_div.find_all('a', {'class': 'newsline article featured breaking-featured'}):
653
+ featured_id = featured_news_div['href'].split('/')[2]
654
+ featured_title = featured_news_div.find('div', {'class': 'featured-newstext'}).text
655
+ featured_description = featured_news_div.find('div', {'class': 'featured-small-newstext'}).text
656
+ f_news.append({
657
+ 'f_id': featured_id,
658
+ 'f_title': featured_title,
659
+ 'f_desc': featured_description,
660
+ })
661
+
662
+ if not only_featured and reg_news_num < max_reg_news:
663
+ for news_div in news_date_div.find_all('a',
664
+ {'class': 'newsline article'}):
665
+ if reg_news_num > max_reg_news:
666
+ break
667
+ if news_div['class'] != 'newsline article featured breaking-featured':
668
+ news_id = news_div['href'].split('/')[2]
669
+ news_title = news_div.find('div', {'class': 'newstext'}).text
670
+ news_posted = news_div.find('div', {'class': 'newsrecent'}).text
671
+
672
+ reg_news.append({
673
+ 'id': news_id,
674
+ 'title': news_title,
675
+ 'posted': news_posted,
676
+ })
677
+ reg_news_num += 1
678
+
679
+ news.append({
680
+ 'date': date_,
681
+ 'f_news': f_news,
682
+ 'news': reg_news,
683
+ })
684
+
685
+ if only_today:
686
+ break
687
+
688
+ return news
638
689
 
639
690
 
640
691
  async def test():
641
692
  hltv = Hltv()
642
- print(await hltv.get_upcoming_matches())
693
+ print(await hltv.get_last_news(only_today=True, max_reg_news=1))
643
694
 
644
695
 
645
696
  if __name__ == "__main__":
@@ -0,0 +1,186 @@
1
+ Metadata-Version: 2.1
2
+ Name: hltv_async_api
3
+ Version: 0.2.8
4
+ Summary: Hltv-aio An unofficial asynchronous HLTV API Wrapper for Python
5
+ Home-page: https://github.com/akimerslys/aiohltv
6
+ Author: akimerslys
7
+ Author-email: Akim Slys <akimslys2003@gmail.com>
8
+ Project-URL: Homepage, https://github.com/akimerslys/aiohltv
9
+ Project-URL: Issues, https://github.com/akimerslys/aiohltv/issues
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Requires-Python: >=3.9
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+
17
+ # hltv-async-api an unofficial asynchronous HLTV API Wrapper for Python
18
+
19
+ # Features
20
+
21
+ * New and modern fully async library
22
+
23
+ * Supports proxy usage for rate-limiting and privacy
24
+
25
+ * Automatically changes proxy if access is denied
26
+
27
+
28
+ ---
29
+
30
+ # Installation
31
+
32
+ ```
33
+ pip install hltv-async-api
34
+ ```
35
+
36
+ ---
37
+
38
+
39
+ # Simple Usage
40
+
41
+ ```
42
+ from hltv_async_api import Hltv
43
+
44
+ hltv = Hltv()
45
+ live_matches = await hltv.get_live_matches()
46
+ ```
47
+
48
+ ---
49
+
50
+ # Proxy Usage
51
+
52
+ **Load Proxies from list**
53
+
54
+ ```
55
+ proxy_list = ['http://120.234.203.171:9002', 'http://110.38.68.38:80']
56
+
57
+ hltv = Hltv(use_proxy=True, proxy_list=proxy_list)
58
+ ```
59
+
60
+ **Load Proxies from file**
61
+
62
+ ```
63
+ hltv = Hltv(use_proxy=True, proxy_path='PATH_TO_PROXY.TXT')
64
+ ```
65
+
66
+
67
+ **Remove bad proxy from file**
68
+
69
+ ```
70
+ hltv = Hltv(use_proxy=True, proxy_path='PATH_TO_PROXY.TXT', remove_proxy=True)
71
+ ```
72
+
73
+ **Add proxy protocol**
74
+
75
+ ```
76
+ proxy_list = ['120.234.203.171:9002', '110.38.68.38:80']
77
+
78
+ hltv = Hltv(use_proxy=True, proxy_list=proxy_list, proxy_protocol='http')
79
+ ```
80
+
81
+ ---
82
+ # Methods
83
+ * get_upcoming_matches(days: int = 7, min_star_rating: int = 1)
84
+
85
+ -days (the number of days into the future to fetch matches for)
86
+
87
+ -min_star_rating (the minimum star rating for matches to include)
88
+
89
+ ```
90
+ await hltv.get_upcoming_matches(1, 5)
91
+
92
+ >>> ['date': '11/11/2024', 'matches': [team1: 'Natus Vincere' | 'TBD', team2: 'FaZe' | 'TBD', time: '14:15', maps: '3', stars: 5, 'PGL CS2 Major Copenhagen 2024' | None]]```
93
+
94
+ ```
95
+
96
+ * get_event_results(event_id: int | str)
97
+
98
+
99
+ ```
100
+ await get_event_results(7148)
101
+
102
+ >>> ['date': '31-3', 'team1': 'FaZe', 'team2': 'Natus Vincere', 'score1': '1', 'score2': '2']
103
+
104
+ ```
105
+
106
+ * get_event_matches(event_id: str | int):
107
+
108
+ ```
109
+ await hltv.get_event_matches(7148)
110
+
111
+ >>>['team1': 'Natus Vincere', 'team2': 'FaZe', 'date': '11-11' | 'LIVE']
112
+ ```
113
+
114
+ * get_event_info(event_id: str | int, event_title: str) -> (event_id, event_title, event_start, event_end, prize, team_num, location, groups)
115
+
116
+ ```
117
+ await hltv.get_event_info(7148, 'PGL CS2 Major Copenhagen2024')
118
+
119
+ (7148, 'PGL CS2 Major Copenhagen2024', '21-3', '31-3', '$1,250,000', '16', 'Copenhagen, Denmark', [])
120
+ ```
121
+
122
+
123
+ get_top_teams(max_teams=30) -> ['rank', 'title', 'points', 'change', 'id']
124
+
125
+ ```
126
+ await hltv.get_top_teams(2)
127
+
128
+ >>>[{'rank': '1', 'title': 'FaZe', 'points': '939', 'change': '-', 'id': '6667'}, {'rank': '2', 'title': 'Natus Vincere', 'points': '757', 'change': '+4', 'id': '4608'}]
129
+ ```
130
+
131
+ get_team_info(team_id: int | str, title: str) -> (team_id, team_title, rank, [players], coach, average_age, weeks_in_top_20, last_trophy, total_trophys)
132
+
133
+ ```
134
+ await hltv.get_team_info(6667, 'faze')
135
+
136
+ >>>(6667, 'faze', '1', ['karrigan', 'rain', 'frozen', 'ropz', 'broky'], 'NEO', '26.5', '256', 'CS Asia Championships 2023', 21)
137
+ ```
138
+
139
+ get_last_news(self, max_reg_news=2, only_today=True, only_featured=False) -> [date, [featured_id, featured_title, featured_desciption], [regular_id, reg_title, reg_time]]
140
+
141
+ ```
142
+ await hltv.get_last_news(only_today=True, max_reg_news=1)
143
+
144
+ >>>[{'date': '02-04', 'f_news': [{'f_id': '38682', 'f_title': 'NIP confirm r1nkle signing', 'f_desc': "Ninjas in Pyjamas only have an anchor player left to sign following the young Ukrainian AWPer's addition."}], 'news': [{'id': '38685', 'title': 'Rounds add sLowi, p3kko', 'posted': 'an hour ago'}, {'id': '38690', 'title': 'n1ssim returns to Sharks after paiN loan deal expires', 'posted': 'an hour ago'}]}]
145
+ ```
146
+ ---
147
+ # Examples
148
+
149
+ ****Simple Example****
150
+
151
+ ```
152
+ from hltv_async_api import Hltv
153
+
154
+
155
+ async def test():
156
+
157
+ hltv = Hltv()
158
+
159
+ print(await hltv.get_event_info(7148, 'pgl-cs2-major-copenhagen-2024'))
160
+
161
+ if __name__ == "__main__":
162
+ asyncio.run(test())
163
+ ```
164
+
165
+ ****Proxy Parser****
166
+ ```
167
+ from hltv_async_api import Hltv
168
+
169
+
170
+ async def test():
171
+
172
+ hltv = Hltv(debug=True, use_proxy=True, proxy_path='proxy_test.txt', timeout=1, remove_proxy=True, proxy_protocol='http')
173
+
174
+ print(await hltv.get_event_info(7148, 'pgl-cs2-major-copenhagen-2024'))
175
+
176
+ if __name__ == "__main__":
177
+ asyncio.run(test())
178
+ ```
179
+
180
+
181
+ # Requirements:
182
+
183
+ Python 3.9+
184
+
185
+ License:
186
+ HLTV Async is licensed under the MIT License, allowing for personal and commercial use with minimal restrictions.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "hltv_async_api"
3
- version = "0.2.6"
3
+ version = "0.2.8"
4
4
  authors = [
5
5
  { name="Akim Slys", email="akimslys2003@gmail.com" },
6
6
  ]
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='hltv_async_api',
5
- version='0.2.6',
5
+ version='0.2.8',
6
6
  author='akimerslys',
7
7
  author_email='akimslys2003@gmail.com',
8
8
  description='Hltv-aio: An unofficial asynchronous HLTV API Wrapper for Python',
@@ -1,121 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: hltv_async_api
3
- Version: 0.2.6
4
- Summary: Hltv-aio An unofficial asynchronous HLTV API Wrapper for Python
5
- Home-page: https://github.com/akimerslys/aiohltv
6
- Author: akimerslys
7
- Author-email: Akim Slys <akimslys2003@gmail.com>
8
- Project-URL: Homepage, https://github.com/akimerslys/aiohltv
9
- Project-URL: Issues, https://github.com/akimerslys/aiohltv/issues
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: License :: OSI Approved :: MIT License
12
- Classifier: Operating System :: OS Independent
13
- Requires-Python: >=3.9
14
- Description-Content-Type: text/markdown
15
- License-File: LICENSE
16
-
17
- # hltv-async-api an unofficial asynchronous HLTV API Wrapper for Python
18
-
19
- # Features
20
-
21
- * New and modern fully async library
22
-
23
- * Supports proxy usage for rate-limiting and privacy
24
-
25
- * Automatically changes proxy if access is denied
26
-
27
-
28
- ---
29
-
30
- # Installation
31
-
32
- ```
33
- pip install hltv_async_api
34
- ```
35
-
36
- ---
37
-
38
-
39
- # Simple Usage
40
-
41
- ```
42
- from hltv_async_api import Hltv
43
-
44
- hltv = Hltv()
45
- live_matches = await hltv.get_live_matches()
46
- ```
47
-
48
- ---
49
-
50
- # Proxy Usage
51
-
52
- **Load Proxies from list**
53
-
54
- ```
55
- proxy_list = ['http://120.234.203.171:9002', 'http://110.38.68.38:80']
56
-
57
- hltv = Hltv(use_proxy=True, proxy_list=proxy_list)
58
- ```
59
-
60
- **Load Proxies from file**
61
-
62
- ```
63
- hltv = Hltv(use_proxy=True, proxy_path='PATH_TO_PROXY.TXT')
64
- ```
65
-
66
-
67
- **Remove bad proxy from file**
68
-
69
- ```
70
- hltv = Hltv(use_proxy=True, proxy_path='PATH_TO_PROXY.TXT', remove_proxy=True)
71
- ```
72
-
73
- **Add proxy protocol**
74
-
75
- ```
76
- proxy_list = ['120.234.203.171:9002', '110.38.68.38:80']
77
-
78
- hltv = Hltv(use_proxy=True, proxy_list=proxy_list, proxy_protocol='http')
79
- ```
80
- ---
81
- # Examples
82
-
83
- ****Simple Example****
84
-
85
- ```
86
- from hltv_async_api import Hltv
87
-
88
-
89
- async def test():
90
-
91
- hltv = Hltv()
92
-
93
- print(await hltv.get_event_info(7148, 'pgl-cs2-major-copenhagen-2024'))
94
-
95
- if __name__ == "__main__":
96
- asyncio.run(test())
97
- ```
98
-
99
-
100
- ****Proxy Parser****
101
- ```
102
- from hltv_async_api import Hltv
103
-
104
-
105
- async def test():
106
-
107
- hltv = Hltv(debug=True, use_proxy=True, proxy_path='proxy_test.txt', timeout=1, remove_proxy=True, proxy_protocol='http')
108
-
109
- print(await hltv.get_event_info(7148, 'pgl-cs2-major-copenhagen-2024'))
110
-
111
- if __name__ == "__main__":
112
- asyncio.run(test())
113
- ```
114
-
115
-
116
- # Requirements:
117
-
118
- Python 3.9+
119
-
120
- License:
121
- HLTV Async is licensed under the MIT License, allowing for personal and commercial use with minimal restrictions.
@@ -1,105 +0,0 @@
1
- # hltv-async-api an unofficial asynchronous HLTV API Wrapper for Python
2
-
3
- # Features
4
-
5
- * New and modern fully async library
6
-
7
- * Supports proxy usage for rate-limiting and privacy
8
-
9
- * Automatically changes proxy if access is denied
10
-
11
-
12
- ---
13
-
14
- # Installation
15
-
16
- ```
17
- pip install hltv_async_api
18
- ```
19
-
20
- ---
21
-
22
-
23
- # Simple Usage
24
-
25
- ```
26
- from hltv_async_api import Hltv
27
-
28
- hltv = Hltv()
29
- live_matches = await hltv.get_live_matches()
30
- ```
31
-
32
- ---
33
-
34
- # Proxy Usage
35
-
36
- **Load Proxies from list**
37
-
38
- ```
39
- proxy_list = ['http://120.234.203.171:9002', 'http://110.38.68.38:80']
40
-
41
- hltv = Hltv(use_proxy=True, proxy_list=proxy_list)
42
- ```
43
-
44
- **Load Proxies from file**
45
-
46
- ```
47
- hltv = Hltv(use_proxy=True, proxy_path='PATH_TO_PROXY.TXT')
48
- ```
49
-
50
-
51
- **Remove bad proxy from file**
52
-
53
- ```
54
- hltv = Hltv(use_proxy=True, proxy_path='PATH_TO_PROXY.TXT', remove_proxy=True)
55
- ```
56
-
57
- **Add proxy protocol**
58
-
59
- ```
60
- proxy_list = ['120.234.203.171:9002', '110.38.68.38:80']
61
-
62
- hltv = Hltv(use_proxy=True, proxy_list=proxy_list, proxy_protocol='http')
63
- ```
64
- ---
65
- # Examples
66
-
67
- ****Simple Example****
68
-
69
- ```
70
- from hltv_async_api import Hltv
71
-
72
-
73
- async def test():
74
-
75
- hltv = Hltv()
76
-
77
- print(await hltv.get_event_info(7148, 'pgl-cs2-major-copenhagen-2024'))
78
-
79
- if __name__ == "__main__":
80
- asyncio.run(test())
81
- ```
82
-
83
-
84
- ****Proxy Parser****
85
- ```
86
- from hltv_async_api import Hltv
87
-
88
-
89
- async def test():
90
-
91
- hltv = Hltv(debug=True, use_proxy=True, proxy_path='proxy_test.txt', timeout=1, remove_proxy=True, proxy_protocol='http')
92
-
93
- print(await hltv.get_event_info(7148, 'pgl-cs2-major-copenhagen-2024'))
94
-
95
- if __name__ == "__main__":
96
- asyncio.run(test())
97
- ```
98
-
99
-
100
- # Requirements:
101
-
102
- Python 3.9+
103
-
104
- License:
105
- HLTV Async is licensed under the MIT License, allowing for personal and commercial use with minimal restrictions.
@@ -1,121 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: hltv_async_api
3
- Version: 0.2.6
4
- Summary: Hltv-aio An unofficial asynchronous HLTV API Wrapper for Python
5
- Home-page: https://github.com/akimerslys/aiohltv
6
- Author: akimerslys
7
- Author-email: Akim Slys <akimslys2003@gmail.com>
8
- Project-URL: Homepage, https://github.com/akimerslys/aiohltv
9
- Project-URL: Issues, https://github.com/akimerslys/aiohltv/issues
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: License :: OSI Approved :: MIT License
12
- Classifier: Operating System :: OS Independent
13
- Requires-Python: >=3.9
14
- Description-Content-Type: text/markdown
15
- License-File: LICENSE
16
-
17
- # hltv-async-api an unofficial asynchronous HLTV API Wrapper for Python
18
-
19
- # Features
20
-
21
- * New and modern fully async library
22
-
23
- * Supports proxy usage for rate-limiting and privacy
24
-
25
- * Automatically changes proxy if access is denied
26
-
27
-
28
- ---
29
-
30
- # Installation
31
-
32
- ```
33
- pip install hltv_async_api
34
- ```
35
-
36
- ---
37
-
38
-
39
- # Simple Usage
40
-
41
- ```
42
- from hltv_async_api import Hltv
43
-
44
- hltv = Hltv()
45
- live_matches = await hltv.get_live_matches()
46
- ```
47
-
48
- ---
49
-
50
- # Proxy Usage
51
-
52
- **Load Proxies from list**
53
-
54
- ```
55
- proxy_list = ['http://120.234.203.171:9002', 'http://110.38.68.38:80']
56
-
57
- hltv = Hltv(use_proxy=True, proxy_list=proxy_list)
58
- ```
59
-
60
- **Load Proxies from file**
61
-
62
- ```
63
- hltv = Hltv(use_proxy=True, proxy_path='PATH_TO_PROXY.TXT')
64
- ```
65
-
66
-
67
- **Remove bad proxy from file**
68
-
69
- ```
70
- hltv = Hltv(use_proxy=True, proxy_path='PATH_TO_PROXY.TXT', remove_proxy=True)
71
- ```
72
-
73
- **Add proxy protocol**
74
-
75
- ```
76
- proxy_list = ['120.234.203.171:9002', '110.38.68.38:80']
77
-
78
- hltv = Hltv(use_proxy=True, proxy_list=proxy_list, proxy_protocol='http')
79
- ```
80
- ---
81
- # Examples
82
-
83
- ****Simple Example****
84
-
85
- ```
86
- from hltv_async_api import Hltv
87
-
88
-
89
- async def test():
90
-
91
- hltv = Hltv()
92
-
93
- print(await hltv.get_event_info(7148, 'pgl-cs2-major-copenhagen-2024'))
94
-
95
- if __name__ == "__main__":
96
- asyncio.run(test())
97
- ```
98
-
99
-
100
- ****Proxy Parser****
101
- ```
102
- from hltv_async_api import Hltv
103
-
104
-
105
- async def test():
106
-
107
- hltv = Hltv(debug=True, use_proxy=True, proxy_path='proxy_test.txt', timeout=1, remove_proxy=True, proxy_protocol='http')
108
-
109
- print(await hltv.get_event_info(7148, 'pgl-cs2-major-copenhagen-2024'))
110
-
111
- if __name__ == "__main__":
112
- asyncio.run(test())
113
- ```
114
-
115
-
116
- # Requirements:
117
-
118
- Python 3.9+
119
-
120
- License:
121
- HLTV Async is licensed under the MIT License, allowing for personal and commercial use with minimal restrictions.
File without changes
File without changes