hltv-async-api 0.2.4__tar.gz → 0.2.6__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.
- {hltv_async_api-0.2.4 → hltv_async_api-0.2.6}/PKG-INFO +10 -4
- {hltv_async_api-0.2.4 → hltv_async_api-0.2.6}/README.md +9 -3
- {hltv_async_api-0.2.4 → hltv_async_api-0.2.6}/hltv_async_api/__init__.py +1 -1
- {hltv_async_api-0.2.4 → hltv_async_api-0.2.6}/hltv_async_api/aiohltv.py +54 -12
- {hltv_async_api-0.2.4 → hltv_async_api-0.2.6}/hltv_async_api.egg-info/PKG-INFO +10 -4
- {hltv_async_api-0.2.4 → hltv_async_api-0.2.6}/pyproject.toml +1 -1
- {hltv_async_api-0.2.4 → hltv_async_api-0.2.6}/setup.py +1 -1
- {hltv_async_api-0.2.4 → hltv_async_api-0.2.6}/LICENSE +0 -0
- {hltv_async_api-0.2.4 → hltv_async_api-0.2.6}/hltv_async_api.egg-info/SOURCES.txt +0 -0
- {hltv_async_api-0.2.4 → hltv_async_api-0.2.6}/hltv_async_api.egg-info/dependency_links.txt +0 -0
- {hltv_async_api-0.2.4 → hltv_async_api-0.2.6}/hltv_async_api.egg-info/top_level.txt +0 -0
- {hltv_async_api-0.2.4 → hltv_async_api-0.2.6}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: hltv_async_api
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.6
|
|
4
4
|
Summary: Hltv-aio An unofficial asynchronous HLTV API Wrapper for Python
|
|
5
5
|
Home-page: https://github.com/akimerslys/aiohltv
|
|
6
6
|
Author: akimerslys
|
|
@@ -14,7 +14,7 @@ Requires-Python: >=3.9
|
|
|
14
14
|
Description-Content-Type: text/markdown
|
|
15
15
|
License-File: LICENSE
|
|
16
16
|
|
|
17
|
-
#
|
|
17
|
+
# hltv-async-api an unofficial asynchronous HLTV API Wrapper for Python
|
|
18
18
|
|
|
19
19
|
# Features
|
|
20
20
|
|
|
@@ -30,7 +30,7 @@ License-File: LICENSE
|
|
|
30
30
|
# Installation
|
|
31
31
|
|
|
32
32
|
```
|
|
33
|
-
pip install
|
|
33
|
+
pip install hltv_async_api
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
---
|
|
@@ -39,7 +39,7 @@ pip install hltv-aio
|
|
|
39
39
|
# Simple Usage
|
|
40
40
|
|
|
41
41
|
```
|
|
42
|
-
from
|
|
42
|
+
from hltv_async_api import Hltv
|
|
43
43
|
|
|
44
44
|
hltv = Hltv()
|
|
45
45
|
live_matches = await hltv.get_live_matches()
|
|
@@ -83,6 +83,9 @@ hltv = Hltv(use_proxy=True, proxy_list=proxy_list, proxy_protocol='http')
|
|
|
83
83
|
****Simple Example****
|
|
84
84
|
|
|
85
85
|
```
|
|
86
|
+
from hltv_async_api import Hltv
|
|
87
|
+
|
|
88
|
+
|
|
86
89
|
async def test():
|
|
87
90
|
|
|
88
91
|
hltv = Hltv()
|
|
@@ -96,6 +99,9 @@ if __name__ == "__main__":
|
|
|
96
99
|
|
|
97
100
|
****Proxy Parser****
|
|
98
101
|
```
|
|
102
|
+
from hltv_async_api import Hltv
|
|
103
|
+
|
|
104
|
+
|
|
99
105
|
async def test():
|
|
100
106
|
|
|
101
107
|
hltv = Hltv(debug=True, use_proxy=True, proxy_path='proxy_test.txt', timeout=1, remove_proxy=True, proxy_protocol='http')
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# hltv-async-api an unofficial asynchronous HLTV API Wrapper for Python
|
|
2
2
|
|
|
3
3
|
# Features
|
|
4
4
|
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
# Installation
|
|
15
15
|
|
|
16
16
|
```
|
|
17
|
-
pip install
|
|
17
|
+
pip install hltv_async_api
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
---
|
|
@@ -23,7 +23,7 @@ pip install hltv-aio
|
|
|
23
23
|
# Simple Usage
|
|
24
24
|
|
|
25
25
|
```
|
|
26
|
-
from
|
|
26
|
+
from hltv_async_api import Hltv
|
|
27
27
|
|
|
28
28
|
hltv = Hltv()
|
|
29
29
|
live_matches = await hltv.get_live_matches()
|
|
@@ -67,6 +67,9 @@ hltv = Hltv(use_proxy=True, proxy_list=proxy_list, proxy_protocol='http')
|
|
|
67
67
|
****Simple Example****
|
|
68
68
|
|
|
69
69
|
```
|
|
70
|
+
from hltv_async_api import Hltv
|
|
71
|
+
|
|
72
|
+
|
|
70
73
|
async def test():
|
|
71
74
|
|
|
72
75
|
hltv = Hltv()
|
|
@@ -80,6 +83,9 @@ if __name__ == "__main__":
|
|
|
80
83
|
|
|
81
84
|
****Proxy Parser****
|
|
82
85
|
```
|
|
86
|
+
from hltv_async_api import Hltv
|
|
87
|
+
|
|
88
|
+
|
|
83
89
|
async def test():
|
|
84
90
|
|
|
85
91
|
hltv = Hltv(debug=True, use_proxy=True, proxy_path='proxy_test.txt', timeout=1, remove_proxy=True, proxy_protocol='http')
|
|
@@ -86,8 +86,8 @@ class Hltv:
|
|
|
86
86
|
else:
|
|
87
87
|
proxy = self.PROXY_LIST[0]
|
|
88
88
|
|
|
89
|
-
if self.PROXY_PROTOCOL
|
|
90
|
-
|
|
89
|
+
if self.PROXY_PROTOCOL and proxy != '' and self.PROXY_PROTOCOL not in proxy:
|
|
90
|
+
proxy = self.PROXY_PROTOCOL + '://' + proxy
|
|
91
91
|
|
|
92
92
|
return proxy
|
|
93
93
|
|
|
@@ -145,12 +145,12 @@ class Hltv:
|
|
|
145
145
|
self.logger.info(f"Fetching {url}, code: {response.status}")
|
|
146
146
|
if response.status == 403 or response.status == 404:
|
|
147
147
|
self.logger.debug("Got 403 forbitten")
|
|
148
|
-
return False, self.parse_error_handler(proxy, delay)
|
|
148
|
+
return False, await self.parse_error_handler(proxy, delay)
|
|
149
149
|
|
|
150
150
|
# checking for challenge page.
|
|
151
151
|
result = await response.text()
|
|
152
152
|
if await self.cloudflare_check(result):
|
|
153
|
-
return False, self.parse_error_handler(proxy, delay)
|
|
153
|
+
return False, await self.parse_error_handler(proxy, delay)
|
|
154
154
|
|
|
155
155
|
return True, result
|
|
156
156
|
except (ClientProxyConnectionError, ClientResponseError, ClientOSError,
|
|
@@ -213,18 +213,60 @@ class Hltv:
|
|
|
213
213
|
stars = [line.get('stars') for line in liveMatchContainer]
|
|
214
214
|
return [{'teams': teams, 'maps': maps, 'stars': stars} for teams, maps, stars in zip(matches, maps, stars)]
|
|
215
215
|
|
|
216
|
-
async def get_upcoming_matches(self):
|
|
216
|
+
async def get_upcoming_matches(self, days: int = 7, star_rating: int = 1):
|
|
217
217
|
"""returns a list of all upcoming matches on HLTV"""
|
|
218
218
|
r = await self.fetch("https://www.hltv.org/matches")
|
|
219
|
-
if not r:
|
|
220
|
-
|
|
219
|
+
if not r:return
|
|
220
|
+
|
|
221
|
+
matches = []
|
|
221
222
|
try:
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
223
|
+
|
|
224
|
+
days = 7
|
|
225
|
+
for i, date_div in enumerate(r.find_all('div', {'class': 'upcomingMatchesSection'}), start=1):
|
|
226
|
+
if i > days:
|
|
227
|
+
break
|
|
228
|
+
date_ = date_div.find('span', {'class': 'matchDayHeadline'}).text.split()[-1]
|
|
229
|
+
matches_today = []
|
|
230
|
+
|
|
231
|
+
for match in date_div.find_all('div', {'class': 'upcomingMatch'}):
|
|
232
|
+
time_ = match.find('div', {'class': 'matchTime'}).text
|
|
233
|
+
rating = int(match['stars'])
|
|
234
|
+
if rating >= star_rating:
|
|
235
|
+
maps = match.find('div', {'class': 'matchMeta'}).text[-1:]
|
|
236
|
+
try:
|
|
237
|
+
teams = match.find_all('div', {'class': 'matchTeamName text-ellipsis'})
|
|
238
|
+
|
|
239
|
+
team1 = teams[0].text
|
|
240
|
+
team2 = teams[1].text
|
|
241
|
+
except (IndexError, AttributeError):
|
|
242
|
+
team1 = 'TBD'
|
|
243
|
+
team2 = 'TBD'
|
|
244
|
+
|
|
245
|
+
try:
|
|
246
|
+
event = match.find('div', {'class', 'matchEventName gtSmartphone-only'}).text
|
|
247
|
+
except AttributeError:
|
|
248
|
+
|
|
249
|
+
try:
|
|
250
|
+
event = match.find('span', {'class': 'line-clamp-3'}).text
|
|
251
|
+
except AttributeError:
|
|
252
|
+
event = ''
|
|
253
|
+
|
|
254
|
+
matches_today.append({
|
|
255
|
+
'team1': team1,
|
|
256
|
+
'team2': team2,
|
|
257
|
+
'time': time_,
|
|
258
|
+
'maps': maps,
|
|
259
|
+
'rating': rating,
|
|
260
|
+
'event': event
|
|
261
|
+
})
|
|
262
|
+
|
|
263
|
+
matches.append({
|
|
264
|
+
'date': date_,
|
|
265
|
+
'matches': matches_today
|
|
266
|
+
})
|
|
225
267
|
except AttributeError:
|
|
226
268
|
return None
|
|
227
|
-
return
|
|
269
|
+
return matches
|
|
228
270
|
|
|
229
271
|
async def get_important_upcoming_matches(self, star_rating=1):
|
|
230
272
|
"""returns a list of all upcoming matches on HLTV with the star rating argument (should be between 0 and 5)"""
|
|
@@ -597,7 +639,7 @@ class Hltv:
|
|
|
597
639
|
|
|
598
640
|
async def test():
|
|
599
641
|
hltv = Hltv()
|
|
600
|
-
print(await hltv.
|
|
642
|
+
print(await hltv.get_upcoming_matches())
|
|
601
643
|
|
|
602
644
|
|
|
603
645
|
if __name__ == "__main__":
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: hltv_async_api
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.6
|
|
4
4
|
Summary: Hltv-aio An unofficial asynchronous HLTV API Wrapper for Python
|
|
5
5
|
Home-page: https://github.com/akimerslys/aiohltv
|
|
6
6
|
Author: akimerslys
|
|
@@ -14,7 +14,7 @@ Requires-Python: >=3.9
|
|
|
14
14
|
Description-Content-Type: text/markdown
|
|
15
15
|
License-File: LICENSE
|
|
16
16
|
|
|
17
|
-
#
|
|
17
|
+
# hltv-async-api an unofficial asynchronous HLTV API Wrapper for Python
|
|
18
18
|
|
|
19
19
|
# Features
|
|
20
20
|
|
|
@@ -30,7 +30,7 @@ License-File: LICENSE
|
|
|
30
30
|
# Installation
|
|
31
31
|
|
|
32
32
|
```
|
|
33
|
-
pip install
|
|
33
|
+
pip install hltv_async_api
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
---
|
|
@@ -39,7 +39,7 @@ pip install hltv-aio
|
|
|
39
39
|
# Simple Usage
|
|
40
40
|
|
|
41
41
|
```
|
|
42
|
-
from
|
|
42
|
+
from hltv_async_api import Hltv
|
|
43
43
|
|
|
44
44
|
hltv = Hltv()
|
|
45
45
|
live_matches = await hltv.get_live_matches()
|
|
@@ -83,6 +83,9 @@ hltv = Hltv(use_proxy=True, proxy_list=proxy_list, proxy_protocol='http')
|
|
|
83
83
|
****Simple Example****
|
|
84
84
|
|
|
85
85
|
```
|
|
86
|
+
from hltv_async_api import Hltv
|
|
87
|
+
|
|
88
|
+
|
|
86
89
|
async def test():
|
|
87
90
|
|
|
88
91
|
hltv = Hltv()
|
|
@@ -96,6 +99,9 @@ if __name__ == "__main__":
|
|
|
96
99
|
|
|
97
100
|
****Proxy Parser****
|
|
98
101
|
```
|
|
102
|
+
from hltv_async_api import Hltv
|
|
103
|
+
|
|
104
|
+
|
|
99
105
|
async def test():
|
|
100
106
|
|
|
101
107
|
hltv = Hltv(debug=True, use_proxy=True, proxy_path='proxy_test.txt', timeout=1, remove_proxy=True, proxy_protocol='http')
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|