vlrdevapi 1.0.0__py3-none-any.whl

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.
vlrdevapi/__init__.py ADDED
@@ -0,0 +1,68 @@
1
+ """
2
+ VLR Dev API - Python client for Valorant esports data from VLR.gg
3
+
4
+ Clean, intuitive API with better naming conventions and full type safety.
5
+
6
+ Example usage:
7
+ >>> import vlrdevapi as vlr
8
+ >>>
9
+ >>> # Get upcoming matches
10
+ >>> matches = vlr.matches.upcoming(limit=10)
11
+ >>> for match in matches:
12
+ ... print(f"{match.teams[0]} vs {match.teams[1]}")
13
+ >>>
14
+ >>> # Get player profile
15
+ >>> profile = vlr.players.profile(player_id=123)
16
+ >>> print(f"{profile.handle} from {profile.country}")
17
+ >>>
18
+ >>> # Get series info
19
+ >>> info = vlr.series.info(match_id=456)
20
+ >>> print(f"{info.teams[0].name} vs {info.teams[1].name}")
21
+ """
22
+
23
+ __version__ = "1.0.0"
24
+
25
+ # Import modules for clean API access
26
+ from . import matches
27
+ from . import events
28
+ from . import players
29
+ from . import series
30
+ from . import status
31
+
32
+ # Import exceptions for error handling
33
+ from .exceptions import (
34
+ VlrdevapiError,
35
+ NetworkError,
36
+ ScrapingError,
37
+ DataNotFoundError,
38
+ RateLimitError,
39
+ )
40
+
41
+ # Import status function for convenience
42
+ from .status import check_status
43
+
44
+ __all__ = [
45
+ # Modules - these are the main API entry points
46
+ "matches",
47
+ "events",
48
+ "players",
49
+ "series",
50
+ "status",
51
+
52
+ # Exceptions for error handling
53
+ "VlrdevapiError",
54
+ "NetworkError",
55
+ "ScrapingError",
56
+ "DataNotFoundError",
57
+ "RateLimitError",
58
+
59
+ # Convenience function
60
+ "check_status",
61
+ ]
62
+
63
+ # Note: Models are NOT exported at the top level to prevent confusion.
64
+ # Access them through their modules:
65
+ # - vlr.matches.upcoming() returns Match objects
66
+ # - vlr.players.profile() returns Profile objects
67
+ # - vlr.events.info() returns Info objects
68
+ # - etc.
vlrdevapi/constants.py ADDED
@@ -0,0 +1,7 @@
1
+ """Constants used throughout the library."""
2
+
3
+ VLR_BASE = "https://www.vlr.gg"
4
+ DEFAULT_TIMEOUT = 5.0
5
+ DEFAULT_USER_AGENT = "Mozilla/5.0 (vlrdevapi)"
6
+ MAX_RETRIES = 3
7
+ BACKOFF_FACTOR = 1.0
vlrdevapi/countries.py ADDED
@@ -0,0 +1,199 @@
1
+ """Country code mapping utilities."""
2
+
3
+ from typing import Optional
4
+
5
+ COUNTRY_MAP = {
6
+ "ad": "Andorra",
7
+ "ae": "United Arab Emirates",
8
+ "af": "Afghanistan",
9
+ "al": "Albania",
10
+ "am": "Armenia",
11
+ "an": "Netherlands Antilles",
12
+ "ao": "Angola",
13
+ "ar": "Argentina",
14
+ "at": "Austria",
15
+ "au": "Australia",
16
+ "aw": "Aruba",
17
+ "az": "Azerbaijan",
18
+ "ba": "Bosnia and Herzegovina",
19
+ "bb": "Barbados",
20
+ "bd": "Bangladesh",
21
+ "be": "Belgium",
22
+ "bf": "Burkina Faso",
23
+ "bg": "Bulgaria",
24
+ "bh": "Bahrain",
25
+ "bi": "Burundi",
26
+ "bj": "Benin",
27
+ "bm": "Bermuda",
28
+ "bn": "Brunei",
29
+ "bo": "Bolivia",
30
+ "br": "Brazil",
31
+ "bs": "Bahamas",
32
+ "bt": "Bhutan",
33
+ "bw": "Botswana",
34
+ "by": "Belarus",
35
+ "bz": "Belize",
36
+ "ca": "Canada",
37
+ "cf": "Central African Republic",
38
+ "cg": "Republic of the Congo",
39
+ "ch": "Switzerland",
40
+ "ck": "Cook Islands",
41
+ "cl": "Chile",
42
+ "cm": "Cameroon",
43
+ "cn": "China",
44
+ "co": "Colombia",
45
+ "cr": "Costa Rica",
46
+ "cu": "Cuba",
47
+ "cv": "Cape Verde",
48
+ "cy": "Cyprus",
49
+ "cz": "Czech Republic",
50
+ "de": "Germany",
51
+ "dk": "Denmark",
52
+ "do": "Dominican Republic",
53
+ "dz": "Algeria",
54
+ "ec": "Ecuador",
55
+ "ee": "Estonia",
56
+ "eg": "Egypt",
57
+ "en": "England",
58
+ "es": "Spain",
59
+ "et": "Ethiopia",
60
+ "eu": "Europe",
61
+ "fi": "Finland",
62
+ "fj": "Fiji",
63
+ "fo": "Faroe Islands",
64
+ "fr": "France",
65
+ "ga": "Gabon",
66
+ "gb": "United Kingdom",
67
+ "ge": "Georgia",
68
+ "gi": "Gibraltar",
69
+ "gl": "Greenland",
70
+ "gp": "Guadeloupe",
71
+ "gr": "Greece",
72
+ "gt": "Guatemala",
73
+ "gu": "Guam",
74
+ "gy": "Guyana",
75
+ "hk": "Hong Kong",
76
+ "hn": "Honduras",
77
+ "hr": "Croatia",
78
+ "ht": "Haiti",
79
+ "hu": "Hungary",
80
+ "id": "Indonesia",
81
+ "ie": "Ireland",
82
+ "il": "Israel",
83
+ "in": "India",
84
+ "iq": "Iraq",
85
+ "ir": "Iran",
86
+ "is": "Iceland",
87
+ "it": "Italy",
88
+ "jm": "Jamaica",
89
+ "jo": "Jordan",
90
+ "jp": "Japan",
91
+ "ke": "Kenya",
92
+ "kg": "Kyrgyzstan",
93
+ "kh": "Cambodia",
94
+ "ki": "Kiribati",
95
+ "kp": "North Korea",
96
+ "kr": "South Korea",
97
+ "kw": "Kuwait",
98
+ "ky": "Cayman Islands",
99
+ "kz": "Kazakhstan",
100
+ "la": "Laos",
101
+ "lb": "Lebanon",
102
+ "lc": "Saint Lucia",
103
+ "lk": "Sri Lanka",
104
+ "lt": "Lithuania",
105
+ "lu": "Luxembourg",
106
+ "lv": "Latvia",
107
+ "ly": "Libya",
108
+ "m1": "Mars",
109
+ "ma": "Morocco",
110
+ "mc": "Monaco",
111
+ "md": "Moldova",
112
+ "mg": "Madagascar",
113
+ "mk": "North Macedonia",
114
+ "mm": "Myanmar",
115
+ "mn": "Mongolia",
116
+ "mo": "Macau",
117
+ "mp": "Northern Mariana Islands",
118
+ "ms": "Montserrat",
119
+ "mt": "Malta",
120
+ "mv": "Maldives",
121
+ "mx": "Mexico",
122
+ "my": "Malaysia",
123
+ "mz": "Mozambique",
124
+ "na": "Namibia",
125
+ "nc": "New Caledonia",
126
+ "nf": "Norfolk Island",
127
+ "ng": "Nigeria",
128
+ "ni": "Nicaragua",
129
+ "nl": "Netherlands",
130
+ "no": "Norway",
131
+ "np": "Nepal",
132
+ "nr": "Nauru",
133
+ "nz": "New Zealand",
134
+ "om": "Oman",
135
+ "pa": "Panama",
136
+ "pe": "Peru",
137
+ "pf": "French Polynesia",
138
+ "pg": "Papua New Guinea",
139
+ "ph": "Philippines",
140
+ "pk": "Pakistan",
141
+ "pl": "Poland",
142
+ "pm": "Saint Pierre and Miquelon",
143
+ "pr": "Puerto Rico",
144
+ "ps": "Palestine",
145
+ "pt": "Portugal",
146
+ "py": "Paraguay",
147
+ "qa": "Qatar",
148
+ "ro": "Romania",
149
+ "rs": "Serbia",
150
+ "ru": "Russia",
151
+ "sa": "Saudi Arabia",
152
+ "sb": "Solomon Islands",
153
+ "sc": "Seychelles",
154
+ "sd": "Sudan",
155
+ "se": "Sweden",
156
+ "sg": "Singapore",
157
+ "si": "Slovenia",
158
+ "sk": "Slovakia",
159
+ "sl": "Sierra Leone",
160
+ "sn": "Senegal",
161
+ "so": "Somalia",
162
+ "sr": "Suriname",
163
+ "sv": "El Salvador",
164
+ "sx": "Sint Maarten",
165
+ "sy": "Syria",
166
+ "tb": "East Timor",
167
+ "tc": "Turks and Caicos Islands",
168
+ "tg": "Togo",
169
+ "th": "Thailand",
170
+ "to": "Tonga",
171
+ "tr": "Turkey",
172
+ "tt": "Trinidad and Tobago",
173
+ "tv": "Tuvalu",
174
+ "tw": "Taiwan",
175
+ "tz": "Tanzania",
176
+ "ua": "Ukraine",
177
+ "ug": "Uganda",
178
+ "un": "United Nations",
179
+ "us": "United States",
180
+ "uy": "Uruguay",
181
+ "uz": "Uzbekistan",
182
+ "va": "Vatican City",
183
+ "ve": "Venezuela",
184
+ "vg": "British Virgin Islands",
185
+ "vi": "U.S. Virgin Islands",
186
+ "vn": "Vietnam",
187
+ "wa": "Wales",
188
+ "ws": "Samoa",
189
+ "ye": "Yemen",
190
+ "za": "South Africa",
191
+ "zw": "Zimbabwe",
192
+ }
193
+
194
+
195
+ def map_country_code(code: Optional[str]) -> Optional[str]:
196
+ """Map country code to full country name."""
197
+ if code is None:
198
+ return None
199
+ return COUNTRY_MAP.get(code.lower(), code.lower())