cbbd 1.1.0a1__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.
- cbbd/__init__.py +64 -0
- cbbd/api/__init__.py +10 -0
- cbbd/api/conferences_api.py +176 -0
- cbbd/api/games_api.py +806 -0
- cbbd/api/plays_api.py +761 -0
- cbbd/api/stats_api.py +423 -0
- cbbd/api/teams_api.py +195 -0
- cbbd/api/venues_api.py +176 -0
- cbbd/api_client.py +767 -0
- cbbd/api_response.py +25 -0
- cbbd/configuration.py +443 -0
- cbbd/exceptions.py +167 -0
- cbbd/models/__init__.py +42 -0
- cbbd/models/conference_info.py +80 -0
- cbbd/models/game_box_score_players.py +147 -0
- cbbd/models/game_box_score_players_players_inner.py +238 -0
- cbbd/models/game_box_score_team.py +148 -0
- cbbd/models/game_box_score_team_stats.py +170 -0
- cbbd/models/game_box_score_team_stats_points.py +112 -0
- cbbd/models/game_info.py +212 -0
- cbbd/models/game_media_info.py +133 -0
- cbbd/models/game_media_info_broadcasts_inner.py +74 -0
- cbbd/models/game_status.py +44 -0
- cbbd/models/play_info.py +193 -0
- cbbd/models/play_info_participants_inner.py +74 -0
- cbbd/models/play_type_info.py +74 -0
- cbbd/models/player_season_stats.py +231 -0
- cbbd/models/season_type.py +42 -0
- cbbd/models/team_info.py +160 -0
- cbbd/models/team_season_stats.py +112 -0
- cbbd/models/team_season_unit_stats.py +163 -0
- cbbd/models/team_season_unit_stats_field_goals.py +91 -0
- cbbd/models/team_season_unit_stats_fouls.py +91 -0
- cbbd/models/team_season_unit_stats_four_factors.py +98 -0
- cbbd/models/team_season_unit_stats_points.py +98 -0
- cbbd/models/team_season_unit_stats_rebounds.py +91 -0
- cbbd/models/team_season_unit_stats_turnovers.py +84 -0
- cbbd/models/venue_info.py +102 -0
- cbbd/py.typed +0 -0
- cbbd/rest.py +330 -0
- cbbd-1.1.0a1.dist-info/METADATA +24 -0
- cbbd-1.1.0a1.dist-info/RECORD +44 -0
- cbbd-1.1.0a1.dist-info/WHEEL +5 -0
- cbbd-1.1.0a1.dist-info/top_level.txt +1 -0
cbbd/api_response.py
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
"""API response object."""
|
2
|
+
|
3
|
+
from __future__ import annotations
|
4
|
+
from typing import Any, Dict, Optional
|
5
|
+
from pydantic import Field, StrictInt, StrictStr
|
6
|
+
|
7
|
+
class ApiResponse:
|
8
|
+
"""
|
9
|
+
API response object
|
10
|
+
"""
|
11
|
+
|
12
|
+
status_code: Optional[StrictInt] = Field(None, description="HTTP status code")
|
13
|
+
headers: Optional[Dict[StrictStr, StrictStr]] = Field(None, description="HTTP headers")
|
14
|
+
data: Optional[Any] = Field(None, description="Deserialized data given the data type")
|
15
|
+
raw_data: Optional[Any] = Field(None, description="Raw data (HTTP response body)")
|
16
|
+
|
17
|
+
def __init__(self,
|
18
|
+
status_code=None,
|
19
|
+
headers=None,
|
20
|
+
data=None,
|
21
|
+
raw_data=None) -> None:
|
22
|
+
self.status_code = status_code
|
23
|
+
self.headers = headers
|
24
|
+
self.data = data
|
25
|
+
self.raw_data = raw_data
|
cbbd/configuration.py
ADDED
@@ -0,0 +1,443 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
College Basketball Data API
|
5
|
+
|
6
|
+
This API is in limited Beta for Patreon subscribers. It may have bugs and is subject to changes. API keys can be acquired from the CollegeFootballData.com website.
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1.1.0
|
9
|
+
Contact: admin@collegefootballdata.com
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
11
|
+
|
12
|
+
Do not edit the class manually.
|
13
|
+
""" # noqa: E501
|
14
|
+
|
15
|
+
|
16
|
+
import copy
|
17
|
+
import logging
|
18
|
+
import multiprocessing
|
19
|
+
import sys
|
20
|
+
import urllib3
|
21
|
+
|
22
|
+
import http.client as httplib
|
23
|
+
|
24
|
+
JSON_SCHEMA_VALIDATION_KEYWORDS = {
|
25
|
+
'multipleOf', 'maximum', 'exclusiveMaximum',
|
26
|
+
'minimum', 'exclusiveMinimum', 'maxLength',
|
27
|
+
'minLength', 'pattern', 'maxItems', 'minItems'
|
28
|
+
}
|
29
|
+
|
30
|
+
class Configuration:
|
31
|
+
"""This class contains various settings of the API client.
|
32
|
+
|
33
|
+
:param host: Base url.
|
34
|
+
:param api_key: Dict to store API key(s).
|
35
|
+
Each entry in the dict specifies an API key.
|
36
|
+
The dict key is the name of the security scheme in the OAS specification.
|
37
|
+
The dict value is the API key secret.
|
38
|
+
:param api_key_prefix: Dict to store API prefix (e.g. Bearer).
|
39
|
+
The dict key is the name of the security scheme in the OAS specification.
|
40
|
+
The dict value is an API key prefix when generating the auth data.
|
41
|
+
:param username: Username for HTTP basic authentication.
|
42
|
+
:param password: Password for HTTP basic authentication.
|
43
|
+
:param access_token: Access token.
|
44
|
+
:param server_index: Index to servers configuration.
|
45
|
+
:param server_variables: Mapping with string values to replace variables in
|
46
|
+
templated server configuration. The validation of enums is performed for
|
47
|
+
variables with defined enum values before.
|
48
|
+
:param server_operation_index: Mapping from operation ID to an index to server
|
49
|
+
configuration.
|
50
|
+
:param server_operation_variables: Mapping from operation ID to a mapping with
|
51
|
+
string values to replace variables in templated server configuration.
|
52
|
+
The validation of enums is performed for variables with defined enum
|
53
|
+
values before.
|
54
|
+
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
|
55
|
+
in PEM format.
|
56
|
+
|
57
|
+
:Example:
|
58
|
+
"""
|
59
|
+
|
60
|
+
_default = None
|
61
|
+
|
62
|
+
def __init__(self, host=None,
|
63
|
+
api_key=None, api_key_prefix=None,
|
64
|
+
username=None, password=None,
|
65
|
+
access_token=None,
|
66
|
+
server_index=None, server_variables=None,
|
67
|
+
server_operation_index=None, server_operation_variables=None,
|
68
|
+
ssl_ca_cert=None,
|
69
|
+
) -> None:
|
70
|
+
"""Constructor
|
71
|
+
"""
|
72
|
+
self._base_path = "https://api.collegebasketballdata.com" if host is None else host
|
73
|
+
"""Default Base url
|
74
|
+
"""
|
75
|
+
self.server_index = 0 if server_index is None and host is None else server_index
|
76
|
+
self.server_operation_index = server_operation_index or {}
|
77
|
+
"""Default server index
|
78
|
+
"""
|
79
|
+
self.server_variables = server_variables or {}
|
80
|
+
self.server_operation_variables = server_operation_variables or {}
|
81
|
+
"""Default server variables
|
82
|
+
"""
|
83
|
+
self.temp_folder_path = None
|
84
|
+
"""Temp file folder for downloading files
|
85
|
+
"""
|
86
|
+
# Authentication Settings
|
87
|
+
self.api_key = {}
|
88
|
+
if api_key:
|
89
|
+
self.api_key = api_key
|
90
|
+
"""dict to store API key(s)
|
91
|
+
"""
|
92
|
+
self.api_key_prefix = {}
|
93
|
+
if api_key_prefix:
|
94
|
+
self.api_key_prefix = api_key_prefix
|
95
|
+
"""dict to store API prefix (e.g. Bearer)
|
96
|
+
"""
|
97
|
+
self.refresh_api_key_hook = None
|
98
|
+
"""function hook to refresh API key if expired
|
99
|
+
"""
|
100
|
+
self.username = username
|
101
|
+
"""Username for HTTP basic authentication
|
102
|
+
"""
|
103
|
+
self.password = password
|
104
|
+
"""Password for HTTP basic authentication
|
105
|
+
"""
|
106
|
+
self.access_token = access_token
|
107
|
+
"""Access token
|
108
|
+
"""
|
109
|
+
self.logger = {}
|
110
|
+
"""Logging Settings
|
111
|
+
"""
|
112
|
+
self.logger["package_logger"] = logging.getLogger("cbbd")
|
113
|
+
self.logger["urllib3_logger"] = logging.getLogger("urllib3")
|
114
|
+
self.logger_format = '%(asctime)s %(levelname)s %(message)s'
|
115
|
+
"""Log format
|
116
|
+
"""
|
117
|
+
self.logger_stream_handler = None
|
118
|
+
"""Log stream handler
|
119
|
+
"""
|
120
|
+
self.logger_file_handler = None
|
121
|
+
"""Log file handler
|
122
|
+
"""
|
123
|
+
self.logger_file = None
|
124
|
+
"""Debug file location
|
125
|
+
"""
|
126
|
+
self.debug = False
|
127
|
+
"""Debug switch
|
128
|
+
"""
|
129
|
+
|
130
|
+
self.verify_ssl = True
|
131
|
+
"""SSL/TLS verification
|
132
|
+
Set this to false to skip verifying SSL certificate when calling API
|
133
|
+
from https server.
|
134
|
+
"""
|
135
|
+
self.ssl_ca_cert = ssl_ca_cert
|
136
|
+
"""Set this to customize the certificate file to verify the peer.
|
137
|
+
"""
|
138
|
+
self.cert_file = None
|
139
|
+
"""client certificate file
|
140
|
+
"""
|
141
|
+
self.key_file = None
|
142
|
+
"""client key file
|
143
|
+
"""
|
144
|
+
self.assert_hostname = None
|
145
|
+
"""Set this to True/False to enable/disable SSL hostname verification.
|
146
|
+
"""
|
147
|
+
self.tls_server_name = None
|
148
|
+
"""SSL/TLS Server Name Indication (SNI)
|
149
|
+
Set this to the SNI value expected by the server.
|
150
|
+
"""
|
151
|
+
|
152
|
+
self.connection_pool_maxsize = multiprocessing.cpu_count() * 5
|
153
|
+
"""urllib3 connection pool's maximum number of connections saved
|
154
|
+
per pool. urllib3 uses 1 connection as default value, but this is
|
155
|
+
not the best value when you are making a lot of possibly parallel
|
156
|
+
requests to the same host, which is often the case here.
|
157
|
+
cpu_count * 5 is used as default value to increase performance.
|
158
|
+
"""
|
159
|
+
|
160
|
+
self.proxy = None
|
161
|
+
"""Proxy URL
|
162
|
+
"""
|
163
|
+
self.proxy_headers = None
|
164
|
+
"""Proxy headers
|
165
|
+
"""
|
166
|
+
self.safe_chars_for_path_param = ''
|
167
|
+
"""Safe chars for path_param
|
168
|
+
"""
|
169
|
+
self.retries = None
|
170
|
+
"""Adding retries to override urllib3 default value 3
|
171
|
+
"""
|
172
|
+
# Enable client side validation
|
173
|
+
self.client_side_validation = True
|
174
|
+
|
175
|
+
self.socket_options = None
|
176
|
+
"""Options to pass down to the underlying urllib3 socket
|
177
|
+
"""
|
178
|
+
|
179
|
+
self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z"
|
180
|
+
"""datetime format
|
181
|
+
"""
|
182
|
+
|
183
|
+
self.date_format = "%Y-%m-%d"
|
184
|
+
"""date format
|
185
|
+
"""
|
186
|
+
|
187
|
+
def __deepcopy__(self, memo):
|
188
|
+
cls = self.__class__
|
189
|
+
result = cls.__new__(cls)
|
190
|
+
memo[id(self)] = result
|
191
|
+
for k, v in self.__dict__.items():
|
192
|
+
if k not in ('logger', 'logger_file_handler'):
|
193
|
+
setattr(result, k, copy.deepcopy(v, memo))
|
194
|
+
# shallow copy of loggers
|
195
|
+
result.logger = copy.copy(self.logger)
|
196
|
+
# use setters to configure loggers
|
197
|
+
result.logger_file = self.logger_file
|
198
|
+
result.debug = self.debug
|
199
|
+
return result
|
200
|
+
|
201
|
+
def __setattr__(self, name, value):
|
202
|
+
object.__setattr__(self, name, value)
|
203
|
+
|
204
|
+
@classmethod
|
205
|
+
def set_default(cls, default):
|
206
|
+
"""Set default instance of configuration.
|
207
|
+
|
208
|
+
It stores default configuration, which can be
|
209
|
+
returned by get_default_copy method.
|
210
|
+
|
211
|
+
:param default: object of Configuration
|
212
|
+
"""
|
213
|
+
cls._default = default
|
214
|
+
|
215
|
+
@classmethod
|
216
|
+
def get_default_copy(cls):
|
217
|
+
"""Deprecated. Please use `get_default` instead.
|
218
|
+
|
219
|
+
Deprecated. Please use `get_default` instead.
|
220
|
+
|
221
|
+
:return: The configuration object.
|
222
|
+
"""
|
223
|
+
return cls.get_default()
|
224
|
+
|
225
|
+
@classmethod
|
226
|
+
def get_default(cls):
|
227
|
+
"""Return the default configuration.
|
228
|
+
|
229
|
+
This method returns newly created, based on default constructor,
|
230
|
+
object of Configuration class or returns a copy of default
|
231
|
+
configuration.
|
232
|
+
|
233
|
+
:return: The configuration object.
|
234
|
+
"""
|
235
|
+
if cls._default is None:
|
236
|
+
cls._default = Configuration()
|
237
|
+
return cls._default
|
238
|
+
|
239
|
+
@property
|
240
|
+
def logger_file(self):
|
241
|
+
"""The logger file.
|
242
|
+
|
243
|
+
If the logger_file is None, then add stream handler and remove file
|
244
|
+
handler. Otherwise, add file handler and remove stream handler.
|
245
|
+
|
246
|
+
:param value: The logger_file path.
|
247
|
+
:type: str
|
248
|
+
"""
|
249
|
+
return self.__logger_file
|
250
|
+
|
251
|
+
@logger_file.setter
|
252
|
+
def logger_file(self, value):
|
253
|
+
"""The logger file.
|
254
|
+
|
255
|
+
If the logger_file is None, then add stream handler and remove file
|
256
|
+
handler. Otherwise, add file handler and remove stream handler.
|
257
|
+
|
258
|
+
:param value: The logger_file path.
|
259
|
+
:type: str
|
260
|
+
"""
|
261
|
+
self.__logger_file = value
|
262
|
+
if self.__logger_file:
|
263
|
+
# If set logging file,
|
264
|
+
# then add file handler and remove stream handler.
|
265
|
+
self.logger_file_handler = logging.FileHandler(self.__logger_file)
|
266
|
+
self.logger_file_handler.setFormatter(self.logger_formatter)
|
267
|
+
for _, logger in self.logger.items():
|
268
|
+
logger.addHandler(self.logger_file_handler)
|
269
|
+
|
270
|
+
@property
|
271
|
+
def debug(self):
|
272
|
+
"""Debug status
|
273
|
+
|
274
|
+
:param value: The debug status, True or False.
|
275
|
+
:type: bool
|
276
|
+
"""
|
277
|
+
return self.__debug
|
278
|
+
|
279
|
+
@debug.setter
|
280
|
+
def debug(self, value):
|
281
|
+
"""Debug status
|
282
|
+
|
283
|
+
:param value: The debug status, True or False.
|
284
|
+
:type: bool
|
285
|
+
"""
|
286
|
+
self.__debug = value
|
287
|
+
if self.__debug:
|
288
|
+
# if debug status is True, turn on debug logging
|
289
|
+
for _, logger in self.logger.items():
|
290
|
+
logger.setLevel(logging.DEBUG)
|
291
|
+
# turn on httplib debug
|
292
|
+
httplib.HTTPConnection.debuglevel = 1
|
293
|
+
else:
|
294
|
+
# if debug status is False, turn off debug logging,
|
295
|
+
# setting log level to default `logging.WARNING`
|
296
|
+
for _, logger in self.logger.items():
|
297
|
+
logger.setLevel(logging.WARNING)
|
298
|
+
# turn off httplib debug
|
299
|
+
httplib.HTTPConnection.debuglevel = 0
|
300
|
+
|
301
|
+
@property
|
302
|
+
def logger_format(self):
|
303
|
+
"""The logger format.
|
304
|
+
|
305
|
+
The logger_formatter will be updated when sets logger_format.
|
306
|
+
|
307
|
+
:param value: The format string.
|
308
|
+
:type: str
|
309
|
+
"""
|
310
|
+
return self.__logger_format
|
311
|
+
|
312
|
+
@logger_format.setter
|
313
|
+
def logger_format(self, value):
|
314
|
+
"""The logger format.
|
315
|
+
|
316
|
+
The logger_formatter will be updated when sets logger_format.
|
317
|
+
|
318
|
+
:param value: The format string.
|
319
|
+
:type: str
|
320
|
+
"""
|
321
|
+
self.__logger_format = value
|
322
|
+
self.logger_formatter = logging.Formatter(self.__logger_format)
|
323
|
+
|
324
|
+
def get_api_key_with_prefix(self, identifier, alias=None):
|
325
|
+
"""Gets API key (with prefix if set).
|
326
|
+
|
327
|
+
:param identifier: The identifier of apiKey.
|
328
|
+
:param alias: The alternative identifier of apiKey.
|
329
|
+
:return: The token for api key authentication.
|
330
|
+
"""
|
331
|
+
if self.refresh_api_key_hook is not None:
|
332
|
+
self.refresh_api_key_hook(self)
|
333
|
+
key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None)
|
334
|
+
if key:
|
335
|
+
prefix = self.api_key_prefix.get(identifier)
|
336
|
+
if prefix:
|
337
|
+
return "%s %s" % (prefix, key)
|
338
|
+
else:
|
339
|
+
return key
|
340
|
+
|
341
|
+
def get_basic_auth_token(self):
|
342
|
+
"""Gets HTTP basic authentication header (string).
|
343
|
+
|
344
|
+
:return: The token for basic HTTP authentication.
|
345
|
+
"""
|
346
|
+
username = ""
|
347
|
+
if self.username is not None:
|
348
|
+
username = self.username
|
349
|
+
password = ""
|
350
|
+
if self.password is not None:
|
351
|
+
password = self.password
|
352
|
+
return urllib3.util.make_headers(
|
353
|
+
basic_auth=username + ':' + password
|
354
|
+
).get('authorization')
|
355
|
+
|
356
|
+
def auth_settings(self):
|
357
|
+
"""Gets Auth Settings dict for api client.
|
358
|
+
|
359
|
+
:return: The Auth Settings information dict.
|
360
|
+
"""
|
361
|
+
auth = {}
|
362
|
+
if self.access_token is not None:
|
363
|
+
auth['apiKey'] = {
|
364
|
+
'type': 'bearer',
|
365
|
+
'in': 'header',
|
366
|
+
'key': 'Authorization',
|
367
|
+
'value': 'Bearer ' + self.access_token
|
368
|
+
}
|
369
|
+
return auth
|
370
|
+
|
371
|
+
def to_debug_report(self):
|
372
|
+
"""Gets the essential information for debugging.
|
373
|
+
|
374
|
+
:return: The report for debugging.
|
375
|
+
"""
|
376
|
+
return "Python SDK Debug Report:\n"\
|
377
|
+
"OS: {env}\n"\
|
378
|
+
"Python Version: {pyversion}\n"\
|
379
|
+
"Version of the API: 1.1.0\n"\
|
380
|
+
"SDK Package Version: 1.1.0a1".\
|
381
|
+
format(env=sys.platform, pyversion=sys.version)
|
382
|
+
|
383
|
+
def get_host_settings(self):
|
384
|
+
"""Gets an array of host settings
|
385
|
+
|
386
|
+
:return: An array of host settings
|
387
|
+
"""
|
388
|
+
return [
|
389
|
+
{
|
390
|
+
'url': "https://api.collegebasketballdata.com",
|
391
|
+
'description': "No description provided",
|
392
|
+
}
|
393
|
+
]
|
394
|
+
|
395
|
+
def get_host_from_settings(self, index, variables=None, servers=None):
|
396
|
+
"""Gets host URL based on the index and variables
|
397
|
+
:param index: array index of the host settings
|
398
|
+
:param variables: hash of variable and the corresponding value
|
399
|
+
:param servers: an array of host settings or None
|
400
|
+
:return: URL based on host settings
|
401
|
+
"""
|
402
|
+
if index is None:
|
403
|
+
return self._base_path
|
404
|
+
|
405
|
+
variables = {} if variables is None else variables
|
406
|
+
servers = self.get_host_settings() if servers is None else servers
|
407
|
+
|
408
|
+
try:
|
409
|
+
server = servers[index]
|
410
|
+
except IndexError:
|
411
|
+
raise ValueError(
|
412
|
+
"Invalid index {0} when selecting the host settings. "
|
413
|
+
"Must be less than {1}".format(index, len(servers)))
|
414
|
+
|
415
|
+
url = server['url']
|
416
|
+
|
417
|
+
# go through variables and replace placeholders
|
418
|
+
for variable_name, variable in server.get('variables', {}).items():
|
419
|
+
used_value = variables.get(
|
420
|
+
variable_name, variable['default_value'])
|
421
|
+
|
422
|
+
if 'enum_values' in variable \
|
423
|
+
and used_value not in variable['enum_values']:
|
424
|
+
raise ValueError(
|
425
|
+
"The variable `{0}` in the host URL has invalid value "
|
426
|
+
"{1}. Must be {2}.".format(
|
427
|
+
variable_name, variables[variable_name],
|
428
|
+
variable['enum_values']))
|
429
|
+
|
430
|
+
url = url.replace("{" + variable_name + "}", used_value)
|
431
|
+
|
432
|
+
return url
|
433
|
+
|
434
|
+
@property
|
435
|
+
def host(self):
|
436
|
+
"""Return generated host."""
|
437
|
+
return self.get_host_from_settings(self.server_index, variables=self.server_variables)
|
438
|
+
|
439
|
+
@host.setter
|
440
|
+
def host(self, value):
|
441
|
+
"""Fix base path."""
|
442
|
+
self._base_path = value
|
443
|
+
self.server_index = None
|
cbbd/exceptions.py
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
College Basketball Data API
|
5
|
+
|
6
|
+
This API is in limited Beta for Patreon subscribers. It may have bugs and is subject to changes. API keys can be acquired from the CollegeFootballData.com website.
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1.1.0
|
9
|
+
Contact: admin@collegefootballdata.com
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
11
|
+
|
12
|
+
Do not edit the class manually.
|
13
|
+
""" # noqa: E501
|
14
|
+
|
15
|
+
|
16
|
+
class OpenApiException(Exception):
|
17
|
+
"""The base exception class for all OpenAPIExceptions"""
|
18
|
+
|
19
|
+
|
20
|
+
class ApiTypeError(OpenApiException, TypeError):
|
21
|
+
def __init__(self, msg, path_to_item=None, valid_classes=None,
|
22
|
+
key_type=None) -> None:
|
23
|
+
""" Raises an exception for TypeErrors
|
24
|
+
|
25
|
+
Args:
|
26
|
+
msg (str): the exception message
|
27
|
+
|
28
|
+
Keyword Args:
|
29
|
+
path_to_item (list): a list of keys an indices to get to the
|
30
|
+
current_item
|
31
|
+
None if unset
|
32
|
+
valid_classes (tuple): the primitive classes that current item
|
33
|
+
should be an instance of
|
34
|
+
None if unset
|
35
|
+
key_type (bool): False if our value is a value in a dict
|
36
|
+
True if it is a key in a dict
|
37
|
+
False if our item is an item in a list
|
38
|
+
None if unset
|
39
|
+
"""
|
40
|
+
self.path_to_item = path_to_item
|
41
|
+
self.valid_classes = valid_classes
|
42
|
+
self.key_type = key_type
|
43
|
+
full_msg = msg
|
44
|
+
if path_to_item:
|
45
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
46
|
+
super(ApiTypeError, self).__init__(full_msg)
|
47
|
+
|
48
|
+
|
49
|
+
class ApiValueError(OpenApiException, ValueError):
|
50
|
+
def __init__(self, msg, path_to_item=None) -> None:
|
51
|
+
"""
|
52
|
+
Args:
|
53
|
+
msg (str): the exception message
|
54
|
+
|
55
|
+
Keyword Args:
|
56
|
+
path_to_item (list) the path to the exception in the
|
57
|
+
received_data dict. None if unset
|
58
|
+
"""
|
59
|
+
|
60
|
+
self.path_to_item = path_to_item
|
61
|
+
full_msg = msg
|
62
|
+
if path_to_item:
|
63
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
64
|
+
super(ApiValueError, self).__init__(full_msg)
|
65
|
+
|
66
|
+
|
67
|
+
class ApiAttributeError(OpenApiException, AttributeError):
|
68
|
+
def __init__(self, msg, path_to_item=None) -> None:
|
69
|
+
"""
|
70
|
+
Raised when an attribute reference or assignment fails.
|
71
|
+
|
72
|
+
Args:
|
73
|
+
msg (str): the exception message
|
74
|
+
|
75
|
+
Keyword Args:
|
76
|
+
path_to_item (None/list) the path to the exception in the
|
77
|
+
received_data dict
|
78
|
+
"""
|
79
|
+
self.path_to_item = path_to_item
|
80
|
+
full_msg = msg
|
81
|
+
if path_to_item:
|
82
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
83
|
+
super(ApiAttributeError, self).__init__(full_msg)
|
84
|
+
|
85
|
+
|
86
|
+
class ApiKeyError(OpenApiException, KeyError):
|
87
|
+
def __init__(self, msg, path_to_item=None) -> None:
|
88
|
+
"""
|
89
|
+
Args:
|
90
|
+
msg (str): the exception message
|
91
|
+
|
92
|
+
Keyword Args:
|
93
|
+
path_to_item (None/list) the path to the exception in the
|
94
|
+
received_data dict
|
95
|
+
"""
|
96
|
+
self.path_to_item = path_to_item
|
97
|
+
full_msg = msg
|
98
|
+
if path_to_item:
|
99
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
100
|
+
super(ApiKeyError, self).__init__(full_msg)
|
101
|
+
|
102
|
+
|
103
|
+
class ApiException(OpenApiException):
|
104
|
+
|
105
|
+
def __init__(self, status=None, reason=None, http_resp=None) -> None:
|
106
|
+
if http_resp:
|
107
|
+
self.status = http_resp.status
|
108
|
+
self.reason = http_resp.reason
|
109
|
+
self.body = http_resp.data
|
110
|
+
self.headers = http_resp.getheaders()
|
111
|
+
else:
|
112
|
+
self.status = status
|
113
|
+
self.reason = reason
|
114
|
+
self.body = None
|
115
|
+
self.headers = None
|
116
|
+
|
117
|
+
def __str__(self):
|
118
|
+
"""Custom error messages for exception"""
|
119
|
+
error_message = "({0})\n"\
|
120
|
+
"Reason: {1}\n".format(self.status, self.reason)
|
121
|
+
if self.headers:
|
122
|
+
error_message += "HTTP response headers: {0}\n".format(
|
123
|
+
self.headers)
|
124
|
+
|
125
|
+
if self.body:
|
126
|
+
error_message += "HTTP response body: {0}\n".format(self.body)
|
127
|
+
|
128
|
+
return error_message
|
129
|
+
|
130
|
+
class BadRequestException(ApiException):
|
131
|
+
|
132
|
+
def __init__(self, status=None, reason=None, http_resp=None) -> None:
|
133
|
+
super(BadRequestException, self).__init__(status, reason, http_resp)
|
134
|
+
|
135
|
+
class NotFoundException(ApiException):
|
136
|
+
|
137
|
+
def __init__(self, status=None, reason=None, http_resp=None) -> None:
|
138
|
+
super(NotFoundException, self).__init__(status, reason, http_resp)
|
139
|
+
|
140
|
+
|
141
|
+
class UnauthorizedException(ApiException):
|
142
|
+
|
143
|
+
def __init__(self, status=None, reason=None, http_resp=None) -> None:
|
144
|
+
super(UnauthorizedException, self).__init__(status, reason, http_resp)
|
145
|
+
|
146
|
+
|
147
|
+
class ForbiddenException(ApiException):
|
148
|
+
|
149
|
+
def __init__(self, status=None, reason=None, http_resp=None) -> None:
|
150
|
+
super(ForbiddenException, self).__init__(status, reason, http_resp)
|
151
|
+
|
152
|
+
|
153
|
+
class ServiceException(ApiException):
|
154
|
+
|
155
|
+
def __init__(self, status=None, reason=None, http_resp=None) -> None:
|
156
|
+
super(ServiceException, self).__init__(status, reason, http_resp)
|
157
|
+
|
158
|
+
|
159
|
+
def render_path(path_to_item):
|
160
|
+
"""Returns a string representation of a path"""
|
161
|
+
result = ""
|
162
|
+
for pth in path_to_item:
|
163
|
+
if isinstance(pth, int):
|
164
|
+
result += "[{0}]".format(pth)
|
165
|
+
else:
|
166
|
+
result += "['{0}']".format(pth)
|
167
|
+
return result
|
cbbd/models/__init__.py
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
# flake8: noqa
|
4
|
+
"""
|
5
|
+
College Basketball Data API
|
6
|
+
|
7
|
+
This API is in limited Beta for Patreon subscribers. It may have bugs and is subject to changes. API keys can be acquired from the CollegeFootballData.com website.
|
8
|
+
|
9
|
+
The version of the OpenAPI document: 1.1.0
|
10
|
+
Contact: admin@collegefootballdata.com
|
11
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
12
|
+
|
13
|
+
Do not edit the class manually.
|
14
|
+
""" # noqa: E501
|
15
|
+
|
16
|
+
|
17
|
+
# import models into model package
|
18
|
+
from cbbd.models.conference_info import ConferenceInfo
|
19
|
+
from cbbd.models.game_box_score_players import GameBoxScorePlayers
|
20
|
+
from cbbd.models.game_box_score_players_players_inner import GameBoxScorePlayersPlayersInner
|
21
|
+
from cbbd.models.game_box_score_team import GameBoxScoreTeam
|
22
|
+
from cbbd.models.game_box_score_team_stats import GameBoxScoreTeamStats
|
23
|
+
from cbbd.models.game_box_score_team_stats_points import GameBoxScoreTeamStatsPoints
|
24
|
+
from cbbd.models.game_info import GameInfo
|
25
|
+
from cbbd.models.game_media_info import GameMediaInfo
|
26
|
+
from cbbd.models.game_media_info_broadcasts_inner import GameMediaInfoBroadcastsInner
|
27
|
+
from cbbd.models.game_status import GameStatus
|
28
|
+
from cbbd.models.play_info import PlayInfo
|
29
|
+
from cbbd.models.play_info_participants_inner import PlayInfoParticipantsInner
|
30
|
+
from cbbd.models.play_type_info import PlayTypeInfo
|
31
|
+
from cbbd.models.player_season_stats import PlayerSeasonStats
|
32
|
+
from cbbd.models.season_type import SeasonType
|
33
|
+
from cbbd.models.team_info import TeamInfo
|
34
|
+
from cbbd.models.team_season_stats import TeamSeasonStats
|
35
|
+
from cbbd.models.team_season_unit_stats import TeamSeasonUnitStats
|
36
|
+
from cbbd.models.team_season_unit_stats_field_goals import TeamSeasonUnitStatsFieldGoals
|
37
|
+
from cbbd.models.team_season_unit_stats_fouls import TeamSeasonUnitStatsFouls
|
38
|
+
from cbbd.models.team_season_unit_stats_four_factors import TeamSeasonUnitStatsFourFactors
|
39
|
+
from cbbd.models.team_season_unit_stats_points import TeamSeasonUnitStatsPoints
|
40
|
+
from cbbd.models.team_season_unit_stats_rebounds import TeamSeasonUnitStatsRebounds
|
41
|
+
from cbbd.models.team_season_unit_stats_turnovers import TeamSeasonUnitStatsTurnovers
|
42
|
+
from cbbd.models.venue_info import VenueInfo
|