|
1 |
| -import requests |
2 | 1 | import typing as t
|
3 | 2 | import urllib.parse
|
4 | 3 |
|
5 | 4 | from .lexicon import Lex
|
6 | 5 |
|
7 |
| -from .caller import WebCaller |
| 6 | +from .callers import WebCaller |
8 | 7 |
|
9 | 8 | from .objects import (
|
10 | 9 | DTO,
|
@@ -66,22 +65,22 @@ def __init__(
|
66 | 65 | self.route = route
|
67 | 66 | self.locale = locale
|
68 | 67 | self.region = region
|
69 |
| - self.handle = WebCaller(key, locale, region, route) |
| 68 | + self.handle = WebCaller(key, locale=locale, region=region, route=route) |
70 | 69 |
|
71 | 70 | if load_content:
|
72 | 71 | self.get_content(cache=True)
|
73 | 72 | else:
|
74 | 73 | self.content = None
|
75 | 74 |
|
| 75 | + def __getattribute__(self, name): |
| 76 | + return super(Client, self).__getattribute__(name) |
| 77 | + |
76 | 78 | def _content_if_cache(self) -> ContentDTO:
|
77 | 79 | if content := getattr(self, "content", None):
|
78 | 80 | return content
|
79 | 81 | else:
|
80 | 82 | return ContentDTO(self.handle.call("GET", "content"))
|
81 | 83 |
|
82 |
| - def __getattribute__(self, name): |
83 |
| - return super(Client, self).__getattribute__(name) |
84 |
| - |
85 | 84 | def asset(
|
86 | 85 | self, **attributes: t.Mapping[t.Text, t.Any]
|
87 | 86 | ) -> t.Optional[t.Union[ActDTO, ContentItemDTO]]:
|
@@ -161,7 +160,7 @@ def get_chromas(self, strip: bool = False) -> t.List[ContentItemDTO]:
|
161 | 160 |
|
162 | 161 | return chromas
|
163 | 162 |
|
164 |
| - def get_content(self, cache: bool = True) -> ContentDTO: |
| 163 | + def get_content(self, cache: bool = False) -> ContentDTO: |
165 | 164 | """Get complete content data from VALORANT.
|
166 | 165 |
|
167 | 166 | :param cache: If set to ``True``, the Client will cache the response data,
|
@@ -377,8 +376,7 @@ def get_user_by_name(
|
377 | 376 | :type route: str
|
378 | 377 | :rtype: Optional[AccountDTO]
|
379 | 378 | """
|
380 |
| - vals = name.split("#") |
381 |
| - vals = [urllib.parse.quote(v, safe=Lex.SAFES) for v in vals] |
| 379 | + vals = [urllib.parse.quote(v, safe=Lex.SAFES) for v in name.split("#")] |
382 | 380 |
|
383 | 381 | r = self.handle.call(
|
384 | 382 | "GET",
|
|
0 commit comments