From 0492f2026d5b8a6dc0dffca35ef799a71ab0c23b Mon Sep 17 00:00:00 2001 From: JeMorriso Date: Wed, 16 Jun 2021 20:30:49 -0700 Subject: [PATCH 1/8] Delete old README content --- README.md | 49 +------------------------------------------------ 1 file changed, 1 insertion(+), 48 deletions(-) diff --git a/README.md b/README.md index b8cacf0..92fd6f7 100644 --- a/README.md +++ b/README.md @@ -1,48 +1 @@ -### General Idea - -There will be 2 folders, `api` and `resources`. `api` has all the methods / functions for calling the REST API. For now, there are multiple design alternatives in the `api-*` folders. `resources` has all the classes that get created and returned from the functions in the `api` folder. The classes in `resources` model the structure of the objects returned from the REST API. - -API calls are made easier by allowing the user to create an instance of the `Config` class which stores information such as their API key, timezone, odds type preference, sportsbooks of interest. Timezone, odds type, and sportsbooks are only relevant if we decide to implement extra functionality. Calls to endpoints requiring a date can then utilize a timezone-aware datetime object. - -The created resources should have cleaned and munged data wherever possible, including correct timezone and odds types. So all the data processing will happen between the API call and the returned objects. Parsing the response into defined resources will make it easier to build on top of if there are new features. - -### API class alternatives - -I defined 2 alternatives in `api-methods` and `api-subclasses`. `api-methods` just has all REST endpoints as methods. `api-subclasses` splits the endpoints up into groups. Each endpoint could also be its own class. 2 examples are shown in `api-classes`. - -#### Example calls - -`api-methods`: - -```python -r = rundown(rapidapi_key='foo', timezone='PST', affiliates=['Bovada', 'Pinnacle']) -e = r.events_by_date(sport_id=1, date_=date.today()) -sbs = r.affiliates() -``` - -`api-subclasses`: - -```python -e = Events(rapidapi_key='foo', timezone='PST', affiliates=['Bovada', 'Pinnacle']) -sb = Sportsbook(rapidapi_key='foo') -e_list = e.by_date(sport_id=1, date_=date.today()) -sbs = sb.affiliates() -``` - -Each endpoint as its own class (2 example classes shown in `api-classes`): - -```python -config = Config(rapidapi_key='foo', timezone='PST', affiliates=['Bovada', 'Pinnacle']) -e = EventsByDate(sport_id=1, date_=date.today(), **config) # returns resources.Events -a = Affiliates(**config) # returns list of resources.Affiliate -``` - -### Optimizations - -- dates with timezone -- different odds types -- filter by sportsbook -- Static classes storing affiliates and teams for each sport to avoid extra API calls -- allow for multiple calls to REST API in one function call - - Events by date range - - Events by multiple sports... +# TheRundown Python Client From a57862f95772ddbab2168cfc2af5cf95a1abb2e1 Mon Sep 17 00:00:00 2001 From: JeMorriso Date: Wed, 23 Jun 2021 21:24:16 -0700 Subject: [PATCH 2/8] Swap use of attribute 'teams' `teams` refers to the `Team` resource (from teams_normalized in API response), and `teams_deprecated` refers to the `TeamDeprecated` resource. --- rundown/resources/event.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rundown/resources/event.py b/rundown/resources/event.py index 142f54f..34242ff 100644 --- a/rundown/resources/event.py +++ b/rundown/resources/event.py @@ -1,6 +1,6 @@ from typing import Optional, Union -from pydantic import BaseModel, validator +from pydantic import BaseModel, validator, Field from rundown.resources.team import TeamDeprecated, Team from rundown.resources.schedule import BaseSchedule @@ -68,8 +68,8 @@ class Event(BaseModel): # 'score' may not be populated for games >100 days in advance. score: Optional[Score] = None # 'teams' not populated for games 3 days in advance. - teams: Optional[list[TeamDeprecated]] = None - teams_normalized: list[Team] + teams_deprecated: Optional[list[TeamDeprecated]] = Field(None, alias="teams") + teams: list[Team] = Field(alias="teams_normalized") schedule: BaseSchedule lines: Optional[dict[str, SportsbookLines]] = None line_periods: Optional[dict[str, SportsbookLinePeriods]] = None From a18b98b8446d8daf72d4468275f82ab60570bc6e Mon Sep 17 00:00:00 2001 From: JeMorriso Date: Tue, 29 Jun 2021 09:54:41 -0700 Subject: [PATCH 3/8] Add rundown_refresh fixture --- tests/conftest.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index 5fd9e9c..3125e58 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -64,3 +64,18 @@ def rundown2(request, monkeypatch): patched_build_url_and_get_json(request, original_fn), ) return r + + +@pytest.fixture +def rundown_refresh(request, monkeypatch): + r = Rundown( + os.getenv("RAPIDAPI_KEY"), timezone="America/Phoenix", refresh_cached_data=True + ) + original_fn = r._build_url_and_get_json + # Patch method in order to save JSON data along with VCR cassette. + monkeypatch.setattr( + r, + "_build_url_and_get_json", + patched_build_url_and_get_json(request, original_fn), + ) + return r From ca1a0cb4181e13ce25c8efbbeddd47ad4184733b Mon Sep 17 00:00:00 2001 From: JeMorriso Date: Tue, 29 Jun 2021 09:55:22 -0700 Subject: [PATCH 4/8] Add __init__.py --- rundown/__init__.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 rundown/__init__.py diff --git a/rundown/__init__.py b/rundown/__init__.py new file mode 100644 index 0000000..b8f9674 --- /dev/null +++ b/rundown/__init__.py @@ -0,0 +1 @@ +from rundown.rundown import Rundown From 40bd4e1b66ca2f0454678b93d0873166b59c59b9 Mon Sep 17 00:00:00 2001 From: JeMorriso Date: Tue, 29 Jun 2021 09:55:37 -0700 Subject: [PATCH 5/8] Add mkdocs --- poetry.lock | 339 ++++++++++++++++++++++++++++++++++++++++++++++++- pyproject.toml | 4 + 2 files changed, 338 insertions(+), 5 deletions(-) diff --git a/poetry.lock b/poetry.lock index dc24e09..2a8a4e7 100644 --- a/poetry.lock +++ b/poetry.lock @@ -77,6 +77,17 @@ typing-extensions = ">=3.7.4" colorama = ["colorama (>=0.4.3)"] d = ["aiohttp (>=3.3.2)", "aiohttp-cors"] +[[package]] +name = "blacken-docs" +version = "1.10.0" +description = "Run `black` on python code blocks in documentation files" +category = "dev" +optional = false +python-versions = ">=3.6.1" + +[package.dependencies] +black = ">=19.3b0" + [[package]] name = "certifi" version = "2020.12.5" @@ -108,7 +119,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" name = "click" version = "7.1.2" description = "Composable command line interface toolkit" -category = "dev" +category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" @@ -166,6 +177,20 @@ mccabe = ">=0.6.0,<0.7.0" pycodestyle = ">=2.7.0,<2.8.0" pyflakes = ">=2.3.0,<2.4.0" +[[package]] +name = "ghp-import" +version = "2.0.1" +description = "Copy your docs directly to the gh-pages branch." +category = "main" +optional = false +python-versions = "*" + +[package.dependencies] +python-dateutil = ">=2.8.1" + +[package.extras] +dev = ["twine", "markdown", "flake8"] + [[package]] name = "idna" version = "2.10" @@ -174,6 +199,21 @@ category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +[[package]] +name = "importlib-metadata" +version = "4.5.0" +description = "Read metadata from Python packages" +category = "main" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +zipp = ">=0.5" + +[package.extras] +docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"] +testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "packaging", "pep517", "pyfakefs", "flufl.flake8", "pytest-black (>=0.3.7)", "pytest-mypy", "importlib-resources (>=1.3)"] + [[package]] name = "iniconfig" version = "1.1.1" @@ -254,6 +294,20 @@ parso = ">=0.8.0,<0.9.0" qa = ["flake8 (==3.8.3)", "mypy (==0.782)"] testing = ["Django (<3.1)", "colorama", "docopt", "pytest (<6.0.0)"] +[[package]] +name = "jinja2" +version = "3.0.1" +description = "A very fast and expressive template engine." +category = "main" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +MarkupSafe = ">=2.0" + +[package.extras] +i18n = ["Babel (>=2.7)"] + [[package]] name = "jupyter-client" version = "6.1.12" @@ -285,6 +339,25 @@ python-versions = ">=3.6" pywin32 = {version = ">=1.0", markers = "sys_platform == \"win32\""} traitlets = "*" +[[package]] +name = "markdown" +version = "3.3.4" +description = "Python implementation of Markdown." +category = "main" +optional = false +python-versions = ">=3.6" + +[package.extras] +testing = ["coverage", "pyyaml"] + +[[package]] +name = "markupsafe" +version = "2.0.1" +description = "Safely add untrusted strings to HTML/XML markup." +category = "main" +optional = false +python-versions = ">=3.6" + [[package]] name = "mccabe" version = "0.6.1" @@ -293,6 +366,92 @@ category = "dev" optional = false python-versions = "*" +[[package]] +name = "mergedeep" +version = "1.3.4" +description = "A deep merge function for 🐍." +category = "main" +optional = false +python-versions = ">=3.6" + +[[package]] +name = "mkdocs" +version = "1.2.1" +description = "Project documentation with Markdown." +category = "main" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +click = ">=3.3" +ghp-import = ">=1.0" +importlib-metadata = ">=3.10" +Jinja2 = ">=2.10.1" +Markdown = ">=3.2.1" +mergedeep = ">=1.3.4" +packaging = ">=20.5" +PyYAML = ">=3.10" +pyyaml-env-tag = ">=0.1" +watchdog = ">=2.0" + +[package.extras] +i18n = ["babel (>=2.9.0)"] + +[[package]] +name = "mkdocs-autorefs" +version = "0.2.1" +description = "Automatically link across pages in MkDocs." +category = "main" +optional = false +python-versions = ">=3.6,<4.0" + +[package.dependencies] +Markdown = ">=3.3,<4.0" +mkdocs = ">=1.1,<2.0" + +[[package]] +name = "mkdocs-material" +version = "7.1.8" +description = "A Material Design theme for MkDocs" +category = "main" +optional = false +python-versions = "*" + +[package.dependencies] +markdown = ">=3.2" +mkdocs = ">=1.1" +mkdocs-material-extensions = ">=1.0" +Pygments = ">=2.4" +pymdown-extensions = ">=7.0" + +[[package]] +name = "mkdocs-material-extensions" +version = "1.0.1" +description = "Extension pack for Python Markdown." +category = "main" +optional = false +python-versions = ">=3.5" + +[package.dependencies] +mkdocs-material = ">=5.0.0" + +[[package]] +name = "mkdocstrings" +version = "0.15.2" +description = "Automatic documentation from sources, for MkDocs." +category = "main" +optional = false +python-versions = ">=3.6,<4.0" + +[package.dependencies] +Jinja2 = ">=2.11.1,<4.0" +Markdown = ">=3.3,<4.0" +MarkupSafe = ">=1.1,<3.0" +mkdocs = ">=1.1.1,<2.0.0" +mkdocs-autorefs = ">=0.1,<0.3" +pymdown-extensions = ">=6.3,<9.0" +pytkdocs = ">=0.2.0,<0.12.0" + [[package]] name = "multidict" version = "5.1.0" @@ -321,7 +480,7 @@ python-versions = ">=3.5" name = "packaging" version = "20.9" description = "Core utilities for Python packages" -category = "dev" +category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" @@ -448,15 +607,26 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" name = "pygments" version = "2.8.1" description = "Pygments is a syntax highlighting package written in Python." -category = "dev" +category = "main" optional = false python-versions = ">=3.5" +[[package]] +name = "pymdown-extensions" +version = "8.2" +description = "Extension pack for Python Markdown." +category = "main" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +Markdown = ">=3.2" + [[package]] name = "pyparsing" version = "2.4.7" description = "Python parsing module" -category = "dev" +category = "main" optional = false python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" @@ -530,6 +700,17 @@ python-versions = "*" [package.extras] cli = ["click (>=5.0)"] +[[package]] +name = "pytkdocs" +version = "0.11.1" +description = "Load Python objects documentation." +category = "main" +optional = false +python-versions = ">=3.6.1,<4.0.0" + +[package.extras] +numpy-style = ["docstring_parser (>=0.7.3,<0.8.0)"] + [[package]] name = "pywin32" version = "300" @@ -546,6 +727,17 @@ category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*" +[[package]] +name = "pyyaml-env-tag" +version = "0.1" +description = "A custom YAML tag for referencing environment variables in YAML files. " +category = "main" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +pyyaml = "*" + [[package]] name = "pyzmq" version = "22.0.3" @@ -665,6 +857,17 @@ six = ">=1.5" wrapt = "*" yarl = {version = "*", markers = "python_version >= \"3.6\""} +[[package]] +name = "watchdog" +version = "2.1.2" +description = "Filesystem events monitoring" +category = "main" +optional = false +python-versions = ">=3.6" + +[package.extras] +watchmedo = ["PyYAML (>=3.10)", "argh (>=0.24.1)"] + [[package]] name = "wcwidth" version = "0.2.5" @@ -693,10 +896,22 @@ python-versions = ">=3.6" idna = ">=2.0" multidict = ">=4.0" +[[package]] +name = "zipp" +version = "3.4.1" +description = "Backport of pathlib-compatible object wrapper for zip files" +category = "main" +optional = false +python-versions = ">=3.6" + +[package.extras] +docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"] +testing = ["pytest (>=4.6)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pytest-cov", "pytest-enabler", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy"] + [metadata] lock-version = "1.1" python-versions = "^3.9" -content-hash = "0dd6e0477c1117aafb513a7b925ea1f0b3d3f1533142188b38e403f13f40380f" +content-hash = "f3cb832a9d64455e648f03e764d0cf781f4272a9fe0826bc3d74d45c99bab929" [metadata.files] appdirs = [ @@ -726,6 +941,10 @@ backcall = [ black = [ {file = "black-20.8b1.tar.gz", hash = "sha256:1c02557aa099101b9d21496f8a914e9ed2222ef70336404eeeac8edba836fbea"}, ] +blacken-docs = [ + {file = "blacken_docs-1.10.0-py2.py3-none-any.whl", hash = "sha256:149197a0b17e83121fc10aca9eda1417728fdccebde930a6722f97d87ed30f4b"}, + {file = "blacken_docs-1.10.0.tar.gz", hash = "sha256:e2121c95bf2f8a3ebb3110776d276f850f63b8e5753773ba2b4d0f415d862f23"}, +] certifi = [ {file = "certifi-2020.12.5-py2.py3-none-any.whl", hash = "sha256:719a74fb9e33b9bd44cc7f3a8d94bc35e4049deebe19ba7d8e108280cfd59830"}, {file = "certifi-2020.12.5.tar.gz", hash = "sha256:1a4995114262bffbc2413b159f2a1a480c969de6e6eb13ee966d470af86af59c"}, @@ -859,10 +1078,17 @@ flake8 = [ {file = "flake8-3.9.0-py2.py3-none-any.whl", hash = "sha256:12d05ab02614b6aee8df7c36b97d1a3b2372761222b19b58621355e82acddcff"}, {file = "flake8-3.9.0.tar.gz", hash = "sha256:78873e372b12b093da7b5e5ed302e8ad9e988b38b063b61ad937f26ca58fc5f0"}, ] +ghp-import = [ + {file = "ghp-import-2.0.1.tar.gz", hash = "sha256:753de2eace6e0f7d4edfb3cce5e3c3b98cd52aadb80163303d1d036bda7b4483"}, +] idna = [ {file = "idna-2.10-py2.py3-none-any.whl", hash = "sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"}, {file = "idna-2.10.tar.gz", hash = "sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6"}, ] +importlib-metadata = [ + {file = "importlib_metadata-4.5.0-py3-none-any.whl", hash = "sha256:833b26fb89d5de469b24a390e9df088d4e52e4ba33b01dc5e0e4f41b81a16c00"}, + {file = "importlib_metadata-4.5.0.tar.gz", hash = "sha256:b142cc1dd1342f31ff04bb7d022492b09920cb64fed867cd3ea6f80fe3ebd139"}, +] iniconfig = [ {file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"}, {file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"}, @@ -883,6 +1109,10 @@ jedi = [ {file = "jedi-0.18.0-py2.py3-none-any.whl", hash = "sha256:18456d83f65f400ab0c2d3319e48520420ef43b23a086fdc05dff34132f0fb93"}, {file = "jedi-0.18.0.tar.gz", hash = "sha256:92550a404bad8afed881a137ec9a461fed49eca661414be45059329614ed0707"}, ] +jinja2 = [ + {file = "Jinja2-3.0.1-py3-none-any.whl", hash = "sha256:1f06f2da51e7b56b8f238affdd6b4e2c61e39598a378cc49345bc1bd42a978a4"}, + {file = "Jinja2-3.0.1.tar.gz", hash = "sha256:703f484b47a6af502e743c9122595cc812b0271f661722403114f71a79d0f5a4"}, +] jupyter-client = [ {file = "jupyter_client-6.1.12-py3-none-any.whl", hash = "sha256:e053a2c44b6fa597feebe2b3ecb5eea3e03d1d91cc94351a52931ee1426aecfc"}, {file = "jupyter_client-6.1.12.tar.gz", hash = "sha256:c4bca1d0846186ca8be97f4d2fa6d2bae889cce4892a167ffa1ba6bd1f73e782"}, @@ -891,10 +1121,74 @@ jupyter-core = [ {file = "jupyter_core-4.7.1-py3-none-any.whl", hash = "sha256:8c6c0cac5c1b563622ad49321d5ec47017bd18b94facb381c6973a0486395f8e"}, {file = "jupyter_core-4.7.1.tar.gz", hash = "sha256:79025cb3225efcd36847d0840f3fc672c0abd7afd0de83ba8a1d3837619122b4"}, ] +markdown = [ + {file = "Markdown-3.3.4-py3-none-any.whl", hash = "sha256:96c3ba1261de2f7547b46a00ea8463832c921d3f9d6aba3f255a6f71386db20c"}, + {file = "Markdown-3.3.4.tar.gz", hash = "sha256:31b5b491868dcc87d6c24b7e3d19a0d730d59d3e46f4eea6430a321bed387a49"}, +] +markupsafe = [ + {file = "MarkupSafe-2.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:f9081981fe268bd86831e5c75f7de206ef275defcb82bc70740ae6dc507aee51"}, + {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:0955295dd5eec6cb6cc2fe1698f4c6d84af2e92de33fbcac4111913cd100a6ff"}, + {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:0446679737af14f45767963a1a9ef7620189912317d095f2d9ffa183a4d25d2b"}, + {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:f826e31d18b516f653fe296d967d700fddad5901ae07c622bb3705955e1faa94"}, + {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:fa130dd50c57d53368c9d59395cb5526eda596d3ffe36666cd81a44d56e48872"}, + {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:905fec760bd2fa1388bb5b489ee8ee5f7291d692638ea5f67982d968366bef9f"}, + {file = "MarkupSafe-2.0.1-cp36-cp36m-win32.whl", hash = "sha256:6c4ca60fa24e85fe25b912b01e62cb969d69a23a5d5867682dd3e80b5b02581d"}, + {file = "MarkupSafe-2.0.1-cp36-cp36m-win_amd64.whl", hash = "sha256:b2f4bf27480f5e5e8ce285a8c8fd176c0b03e93dcc6646477d4630e83440c6a9"}, + {file = "MarkupSafe-2.0.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:0717a7390a68be14b8c793ba258e075c6f4ca819f15edfc2a3a027c823718567"}, + {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:6557b31b5e2c9ddf0de32a691f2312a32f77cd7681d8af66c2692efdbef84c18"}, + {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:49e3ceeabbfb9d66c3aef5af3a60cc43b85c33df25ce03d0031a608b0a8b2e3f"}, + {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:d7f9850398e85aba693bb640262d3611788b1f29a79f0c93c565694658f4071f"}, + {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:6a7fae0dd14cf60ad5ff42baa2e95727c3d81ded453457771d02b7d2b3f9c0c2"}, + {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:b7f2d075102dc8c794cbde1947378051c4e5180d52d276987b8d28a3bd58c17d"}, + {file = "MarkupSafe-2.0.1-cp37-cp37m-win32.whl", hash = "sha256:a30e67a65b53ea0a5e62fe23682cfe22712e01f453b95233b25502f7c61cb415"}, + {file = "MarkupSafe-2.0.1-cp37-cp37m-win_amd64.whl", hash = "sha256:611d1ad9a4288cf3e3c16014564df047fe08410e628f89805e475368bd304914"}, + {file = "MarkupSafe-2.0.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:be98f628055368795d818ebf93da628541e10b75b41c559fdf36d104c5787066"}, + {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:1d609f577dc6e1aa17d746f8bd3c31aa4d258f4070d61b2aa5c4166c1539de35"}, + {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:7d91275b0245b1da4d4cfa07e0faedd5b0812efc15b702576d103293e252af1b"}, + {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:01a9b8ea66f1658938f65b93a85ebe8bc016e6769611be228d797c9d998dd298"}, + {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:47ab1e7b91c098ab893b828deafa1203de86d0bc6ab587b160f78fe6c4011f75"}, + {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:97383d78eb34da7e1fa37dd273c20ad4320929af65d156e35a5e2d89566d9dfb"}, + {file = "MarkupSafe-2.0.1-cp38-cp38-win32.whl", hash = "sha256:023cb26ec21ece8dc3907c0e8320058b2e0cb3c55cf9564da612bc325bed5e64"}, + {file = "MarkupSafe-2.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:984d76483eb32f1bcb536dc27e4ad56bba4baa70be32fa87152832cdd9db0833"}, + {file = "MarkupSafe-2.0.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:2ef54abee730b502252bcdf31b10dacb0a416229b72c18b19e24a4509f273d26"}, + {file = "MarkupSafe-2.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:3c112550557578c26af18a1ccc9e090bfe03832ae994343cfdacd287db6a6ae7"}, + {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux1_i686.whl", hash = "sha256:53edb4da6925ad13c07b6d26c2a852bd81e364f95301c66e930ab2aef5b5ddd8"}, + {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:f5653a225f31e113b152e56f154ccbe59eeb1c7487b39b9d9f9cdb58e6c79dc5"}, + {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:4efca8f86c54b22348a5467704e3fec767b2db12fc39c6d963168ab1d3fc9135"}, + {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:ab3ef638ace319fa26553db0624c4699e31a28bb2a835c5faca8f8acf6a5a902"}, + {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:f8ba0e8349a38d3001fae7eadded3f6606f0da5d748ee53cc1dab1d6527b9509"}, + {file = "MarkupSafe-2.0.1-cp39-cp39-win32.whl", hash = "sha256:10f82115e21dc0dfec9ab5c0223652f7197feb168c940f3ef61563fc2d6beb74"}, + {file = "MarkupSafe-2.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:693ce3f9e70a6cf7d2fb9e6c9d8b204b6b39897a2c4a1aa65728d5ac97dcc1d8"}, + {file = "MarkupSafe-2.0.1.tar.gz", hash = "sha256:594c67807fb16238b30c44bdf74f36c02cdf22d1c8cda91ef8a0ed8dabf5620a"}, +] mccabe = [ {file = "mccabe-0.6.1-py2.py3-none-any.whl", hash = "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42"}, {file = "mccabe-0.6.1.tar.gz", hash = "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"}, ] +mergedeep = [ + {file = "mergedeep-1.3.4-py3-none-any.whl", hash = "sha256:70775750742b25c0d8f36c55aed03d24c3384d17c951b3175d898bd778ef0307"}, + {file = "mergedeep-1.3.4.tar.gz", hash = "sha256:0096d52e9dad9939c3d975a774666af186eda617e6ca84df4c94dec30004f2a8"}, +] +mkdocs = [ + {file = "mkdocs-1.2.1-py3-none-any.whl", hash = "sha256:11141126e5896dd9d279b3e4814eb488e409a0990fb638856255020406a8e2e7"}, + {file = "mkdocs-1.2.1.tar.gz", hash = "sha256:6e0ea175366e3a50d334597b0bc042b8cebd512398cdd3f6f34842d0ef524905"}, +] +mkdocs-autorefs = [ + {file = "mkdocs-autorefs-0.2.1.tar.gz", hash = "sha256:b8156d653ed91356e71675ce1fa1186d2b2c2085050012522895c9aa98fca3e5"}, + {file = "mkdocs_autorefs-0.2.1-py3-none-any.whl", hash = "sha256:f301b983a34259df90b3fcf7edc234b5e6c7065bd578781e66fd90b8cfbe76be"}, +] +mkdocs-material = [ + {file = "mkdocs-material-7.1.8.tar.gz", hash = "sha256:e555c66ece5eab7023c4733270dc7627280e707e5082dab278d6a7a4881d2435"}, + {file = "mkdocs_material-7.1.8-py2.py3-none-any.whl", hash = "sha256:08eaf9f77c6d026706397bae2c50d202cfe3a81ef984027b671b4acd365dfc5b"}, +] +mkdocs-material-extensions = [ + {file = "mkdocs-material-extensions-1.0.1.tar.gz", hash = "sha256:6947fb7f5e4291e3c61405bad3539d81e0b3cd62ae0d66ced018128af509c68f"}, + {file = "mkdocs_material_extensions-1.0.1-py3-none-any.whl", hash = "sha256:d90c807a88348aa6d1805657ec5c0b2d8d609c110e62b9dce4daf7fa981fa338"}, +] +mkdocstrings = [ + {file = "mkdocstrings-0.15.2-py3-none-any.whl", hash = "sha256:8d6cbe64c07ae66739010979ca01d49dd2f64d1a45009f089d217b9cd2a65e36"}, + {file = "mkdocstrings-0.15.2.tar.gz", hash = "sha256:c2fee9a3a644647c06eb2044fdfede1073adfd1a55bf6752005d3db10705fe73"}, +] multidict = [ {file = "multidict-5.1.0-cp36-cp36m-macosx_10_14_x86_64.whl", hash = "sha256:b7993704f1a4b204e71debe6095150d43b2ee6150fa4f44d6d966ec356a8d61f"}, {file = "multidict-5.1.0-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:9dd6e9b1a913d096ac95d0399bd737e00f2af1e1594a787e00f7975778c8b2bf"}, @@ -1017,6 +1311,10 @@ pygments = [ {file = "Pygments-2.8.1-py3-none-any.whl", hash = "sha256:534ef71d539ae97d4c3a4cf7d6f110f214b0e687e92f9cb9d2a3b0d3101289c8"}, {file = "Pygments-2.8.1.tar.gz", hash = "sha256:2656e1a6edcdabf4275f9a3640db59fd5de107d88e8663c5d4e9a0fa62f77f94"}, ] +pymdown-extensions = [ + {file = "pymdown-extensions-8.2.tar.gz", hash = "sha256:b6daa94aad9e1310f9c64c8b1f01e4ce82937ab7eb53bfc92876a97aca02a6f4"}, + {file = "pymdown_extensions-8.2-py3-none-any.whl", hash = "sha256:141452d8ed61165518f2c923454bf054866b85cf466feedb0eb68f04acdc2560"}, +] pyparsing = [ {file = "pyparsing-2.4.7-py2.py3-none-any.whl", hash = "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"}, {file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"}, @@ -1041,6 +1339,10 @@ python-dotenv = [ {file = "python-dotenv-0.16.0.tar.gz", hash = "sha256:9fa413c37d4652d3fa02fea0ff465c384f5db75eab259c4fc5d0c5b8bf20edd4"}, {file = "python_dotenv-0.16.0-py2.py3-none-any.whl", hash = "sha256:31d752f5b748f4e292448c9a0cac6a08ed5e6f4cefab85044462dcad56905cec"}, ] +pytkdocs = [ + {file = "pytkdocs-0.11.1-py3-none-any.whl", hash = "sha256:89ca4926d0acc266235beb24cb0b0591aa6bf7adedfae54bf9421d529d782c8d"}, + {file = "pytkdocs-0.11.1.tar.gz", hash = "sha256:1ec7e028fe8361acc1ce909ada4e6beabec28ef31e629618549109e1d58549f0"}, +] pywin32 = [ {file = "pywin32-300-cp35-cp35m-win32.whl", hash = "sha256:1c204a81daed2089e55d11eefa4826c05e604d27fe2be40b6bf8db7b6a39da63"}, {file = "pywin32-300-cp35-cp35m-win_amd64.whl", hash = "sha256:350c5644775736351b77ba68da09a39c760d75d2467ecec37bd3c36a94fbed64"}, @@ -1084,6 +1386,10 @@ pyyaml = [ {file = "PyYAML-5.4.1-cp39-cp39-win_amd64.whl", hash = "sha256:c20cfa2d49991c8b4147af39859b167664f2ad4561704ee74c1de03318e898db"}, {file = "PyYAML-5.4.1.tar.gz", hash = "sha256:607774cbba28732bfa802b54baa7484215f530991055bb562efbed5b2f20a45e"}, ] +pyyaml-env-tag = [ + {file = "pyyaml_env_tag-0.1-py3-none-any.whl", hash = "sha256:af31106dec8a4d68c60207c1886031cbf839b68aa7abccdb19868200532c2069"}, + {file = "pyyaml_env_tag-0.1.tar.gz", hash = "sha256:70092675bda14fdec33b31ba77e7543de9ddc88f2e5b99160396572d11525bdb"}, +] pyzmq = [ {file = "pyzmq-22.0.3-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:c0cde362075ee8f3d2b0353b283e203c2200243b5a15d5c5c03b78112a17e7d4"}, {file = "pyzmq-22.0.3-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:ff1ea14075bbddd6f29bf6beb8a46d0db779bcec6b9820909584081ec119f8fd"}, @@ -1265,6 +1571,25 @@ vcrpy = [ {file = "vcrpy-4.1.1-py2.py3-none-any.whl", hash = "sha256:12c3fcdae7b88ecf11fc0d3e6d77586549d4575a2ceee18e82eee75c1f626162"}, {file = "vcrpy-4.1.1.tar.gz", hash = "sha256:57095bf22fc0a2d99ee9674cdafebed0f3ba763018582450706f7d3a74fff599"}, ] +watchdog = [ + {file = "watchdog-2.1.2-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:581e3548159fe7d2a9f377a1fbcb41bdcee46849cca8ab803c7ac2e5e04ec77c"}, + {file = "watchdog-2.1.2-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:edcd9ef3fd460bb8a98eb1fcf99941e9fd9f275f45f1a82cb1359ec92975d647"}, + {file = "watchdog-2.1.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:d34ce2261f118ecd57eedeef95fc2a495fc4a40b3ed7b3bf0bd7a8ccc1ab4f8f"}, + {file = "watchdog-2.1.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:668391e6c32742d76e5be5db6bf95c455fa4b3d11e76a77c13b39bccb3a47a72"}, + {file = "watchdog-2.1.2-pp36-pypy36_pp73-macosx_10_9_x86_64.whl", hash = "sha256:6ef9fe57162c4c361692620e1d9167574ba1975ee468b24051ca11c9bba6438e"}, + {file = "watchdog-2.1.2-pp37-pypy37_pp73-macosx_10_9_x86_64.whl", hash = "sha256:58ebb1095ee493008a7789d47dd62e4999505d82be89fc884d473086fccc6ebd"}, + {file = "watchdog-2.1.2-py3-none-manylinux2014_aarch64.whl", hash = "sha256:91387ee2421f30b75f7ff632c9d48f76648e56bf346a7c805c0a34187a93aab4"}, + {file = "watchdog-2.1.2-py3-none-manylinux2014_armv7l.whl", hash = "sha256:a6471517315a8541a943c00b45f1d252e36898a3ae963d2d52509b89a50cb2b9"}, + {file = "watchdog-2.1.2-py3-none-manylinux2014_i686.whl", hash = "sha256:a42e6d652f820b2b94cd03156c62559a2ea68d476476dfcd77d931e7f1012d4a"}, + {file = "watchdog-2.1.2-py3-none-manylinux2014_ppc64.whl", hash = "sha256:3d6405681471ebe0beb3aa083998c4870e48b57f8afdb45ea1b5957cc5cf1014"}, + {file = "watchdog-2.1.2-py3-none-manylinux2014_ppc64le.whl", hash = "sha256:598d772beeaf9c98d0df946fbabf0c8365dd95ea46a250c224c725fe0c4730bc"}, + {file = "watchdog-2.1.2-py3-none-manylinux2014_s390x.whl", hash = "sha256:4b219d46d89cfa49af1d73175487c14a318a74cb8c5442603fd13c6a5b418c86"}, + {file = "watchdog-2.1.2-py3-none-manylinux2014_x86_64.whl", hash = "sha256:188145185c08c73c56f1478ccf1f0f0f85101191439679b35b6b100886ce0b39"}, + {file = "watchdog-2.1.2-py3-none-win32.whl", hash = "sha256:255a32d44bbbe62e52874ff755e2eefe271b150e0ec240ad7718a62a7a7a73c4"}, + {file = "watchdog-2.1.2-py3-none-win_amd64.whl", hash = "sha256:1a62a4671796dc93d1a7262286217d9e75823c63d4c42782912d39a506d30046"}, + {file = "watchdog-2.1.2-py3-none-win_ia64.whl", hash = "sha256:104266a778906ae0e971368d368a65c4cd032a490a9fca5ba0b78c6c7ae11720"}, + {file = "watchdog-2.1.2.tar.gz", hash = "sha256:0237db4d9024859bea27d0efb59fe75eef290833fd988b8ead7a879b0308c2db"}, +] wcwidth = [ {file = "wcwidth-0.2.5-py2.py3-none-any.whl", hash = "sha256:beb4802a9cebb9144e99086eff703a642a13d6a0052920003a230f3294bbe784"}, {file = "wcwidth-0.2.5.tar.gz", hash = "sha256:c4d647b99872929fdb7bdcaa4fbe7f01413ed3d98077df798530e5b04f116c83"}, @@ -1311,3 +1636,7 @@ yarl = [ {file = "yarl-1.6.3-cp39-cp39-win_amd64.whl", hash = "sha256:4953fb0b4fdb7e08b2f3b3be80a00d28c5c8a2056bb066169de00e6501b986b6"}, {file = "yarl-1.6.3.tar.gz", hash = "sha256:8a9066529240171b68893d60dca86a763eae2139dd42f42106b03cf4b426bf10"}, ] +zipp = [ + {file = "zipp-3.4.1-py3-none-any.whl", hash = "sha256:51cb66cc54621609dd593d1787f286ee42a5c0adbb4b29abea5a63edc3e03098"}, + {file = "zipp-3.4.1.tar.gz", hash = "sha256:3607921face881ba3e026887d8150cca609d517579abe052ac81fc5aeffdbd76"}, +] diff --git a/pyproject.toml b/pyproject.toml index 760026d..4805a3b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,6 +10,8 @@ requests = "^2.25.1" arrow = "^1.0.3" pydantic = "^1.8.1" PyYAML = "^5.4.1" +mkdocs-material = "^7.1.8" +mkdocstrings = "^0.15.2" [tool.poetry.dev-dependencies] pytest = "^6.2.2" @@ -21,6 +23,8 @@ python-dotenv = "^0.16.0" ipykernel = "^5.5.3" pytest-vcr = "^1.0.2" deepdiff = "^5.5.0" +pymdown-extensions = "^8.2" +blacken-docs = "^1.10.0" [build-system] requires = ["poetry-core>=1.0.0"] From 96243db821dbf610fe167bf37f16e485ab33feb1 Mon Sep 17 00:00:00 2001 From: JeMorriso Date: Tue, 29 Jun 2021 09:55:52 -0700 Subject: [PATCH 6/8] Add mkdocs configuration --- mkdocs.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 mkdocs.yml diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..2d4b25f --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,32 @@ +site_name: TheRundown Python +site_url: https://example.com/ + +theme: + name: material + favicon: favicon.png + # logo: favicon.png + palette: + scheme: slate + primary: black + accent: deep orange + +repo_name: therundown-python +repo_url: https://github.com/TheRundown/therundown-python + +plugins: +- search +- mkdocstrings + +markdown_extensions: + - pymdownx.highlight + - pymdownx.superfences + +nav: + - Overview & Installation: index.md + - usage.md + - Documentation: + - Rundown API Client: code-reference/rundown.md + - Resources: code-reference/resources.md + +# extra: +# generator: false From ea6d18be8d375776d69312baaddce64a339aaf0a Mon Sep 17 00:00:00 2001 From: JeMorriso Date: Tue, 29 Jun 2021 09:57:06 -0700 Subject: [PATCH 7/8] Update docstrings --- rundown/resources/date.py | 12 +++- rundown/resources/event.py | 65 ++++++++++++++++++- rundown/resources/events.py | 13 +++- rundown/resources/line.py | 104 +++++++++++++++++++++++++++---- rundown/resources/lineperiods.py | 13 +++- rundown/resources/schedule.py | 32 +++++++++- rundown/resources/sport.py | 7 ++- rundown/resources/sportsbook.py | 8 ++- rundown/resources/team.py | 26 +++++++- rundown/rundown.py | 33 +++++----- rundown/static/sports.yaml | 4 +- rundown/static/sportsbooks.yaml | 26 ++++---- 12 files changed, 287 insertions(+), 56 deletions(-) diff --git a/rundown/resources/date.py b/rundown/resources/date.py index da605da..a7e1e1a 100644 --- a/rundown/resources/date.py +++ b/rundown/resources/date.py @@ -7,7 +7,11 @@ class Date(BaseModel): - """Date class for returning dates in ISO 8601 string format.""" + """Date class for returning dates in ISO 8601 string format. + + attributes: + date: ISO 8601 date + """ date: str @@ -25,6 +29,10 @@ def make_timezone(cls, v): class Epoch(BaseModel): - """Epoch class for returning dates in timestamp format.""" + """Epoch class for returning dates in timestamp format. + + attributes: + timestamp: Epoch timestamp + """ timestamp: int diff --git a/rundown/resources/event.py b/rundown/resources/event.py index 34242ff..12ae8e3 100644 --- a/rundown/resources/event.py +++ b/rundown/resources/event.py @@ -13,6 +13,15 @@ class SportsbookLines(BaseModel): + """ + attributes: + line_id: Line ID + moneyline: Moneyline + spread: Spread + total: Total + affiliate: Sportsbook + """ + line_id: int moneyline: Moneyline spread: Spread @@ -21,11 +30,31 @@ class SportsbookLines(BaseModel): class SportsbookLinePeriod(SportsbookLines): + """ + Inherits from SportsbookLines. + + attributes: + period_id: Period ID + period_description: Period description + """ + period_id: Optional[int] period_description: str class SportsbookLinePeriods(BaseModel): + """ + attributes: + period_full_game: SportsbookLinePeriod + period_first_half: SportsbookLinePeriod + period_second_half: SportsbookLinePeriod + period_first_period: SportsbookLinePeriod + period_second_period: SportsbookLinePeriod + period_third_period: SportsbookLinePeriod + period_fourth_period: SportsbookLinePeriod + period_live_full_game: SportsbookLinePeriod + """ + period_full_game: SportsbookLinePeriod period_first_half: SportsbookLinePeriod period_second_half: SportsbookLinePeriod @@ -37,6 +66,25 @@ class SportsbookLinePeriods(BaseModel): class Score(BaseModel): + """ + attributes: + event_id: Event ID + event_status: Event status + score_away: Away team score + score_home: Home team score + winner_away: 1 if away won, 0 otherwise + winner_home: 1 if home won, 0 otherwise + score_away_by_period: Away team score by period + score_home_by_period: Home team score by period + venue_name: Venue name + venue_location: Venue location + game_clock: Game clock + display_clock: Display clock + game_period: Game period + broadcast: Broadcast + event_status_detail: Event status detail + """ + event_id: str event_status: str score_away: int @@ -55,7 +103,22 @@ class Score(BaseModel): class Event(BaseModel): - """Event class describing an available event or game.""" + """Event class describing an available event or game. + + attributes: + event_id: Event ID + event_uuid: Event UUID + sport_id: Sport ID + event_date: Event date + rotation_number_away: Away team rotation number + rotation_number_home: Home team rotation number + score: Score + teams_deprecated: list of TeamDeprecated + teams: list of Team + schedule: Schedule + lines: dict of SportsbookLines + line_periods: dict of SportsbookLinePeriods + """ event_id: str # Some NCAAF and old NHL events don't have uuid. diff --git a/rundown/resources/events.py b/rundown/resources/events.py index bf24ace..56b3ada 100644 --- a/rundown/resources/events.py +++ b/rundown/resources/events.py @@ -6,13 +6,22 @@ class Meta(BaseModel): - """Meta contains delta_last_id, which is used by Rundown.events_delta.""" + """Meta contains delta_last_id, which is used by Rundown.events_delta. + + attributes: + delta_last_id: ID to use in Rundown.events_delta() to get updated events. + """ delta_last_id: str class Events(BaseModel): - """Class holding a list of Event resources. Used by Rundown events methods.""" + """Class holding a list of Event resources. Used by Rundown events methods. + + attributes: + meta: Meta + events: list of Event + """ meta: Meta events: list[Event] diff --git a/rundown/resources/line.py b/rundown/resources/line.py index b267e95..19edfe2 100644 --- a/rundown/resources/line.py +++ b/rundown/resources/line.py @@ -8,7 +8,14 @@ class Line(BaseModel): - """Base line class holding information common to all line classes.""" + """Base line class holding information common to all line classes. + + attributes: + line_id: Line ID + date_updated: Date updated + format: Odds type + + """ line_id: int date_updated: str @@ -18,14 +25,28 @@ class Line(BaseModel): class ExtendedLine(Line): - """Line object with added fields, used by Totals and Spread.""" + """Line object with added fields, used by Totals and Spread. Inherits from Line. + + attributes: + event_id: Event ID + affiliate_id: Affiliate ID + """ event_id: str affiliate_id: int class Moneyline(Line): - """Class with attributes specific to moneyline bets.""" + """Class with attributes specific to moneyline bets. Inherits from Line. + + attributes: + moneyline_away: Away team moneyline + moneyline_away_delta: Change in odds compared to previous + moneyline_home: Home team moneyline + moneyline_home_delta: Change in odds compared to previous + moneyline_draw: Draw moneyline + moneyline_draw_delta: Change in odds compared to previous + """ moneyline_away: Union[StrictInt, StrictFloat] = None moneyline_away_delta: Union[StrictInt, StrictFloat] = None @@ -46,15 +67,30 @@ class Moneyline(Line): class MoneylinePeriod(Moneyline): - """Moneyline class for different periods / quarters / halves of a game.""" + """Moneyline class for different periods / quarters / halves of a game. Inherits from MoneyLine. + + attributes: + period_id: Period ID + period_description: Period description + """ period_id: int period_description: str class SpreadElement(BaseModel): - """Class used by the extended_spread attribute of the Spread class for alternate - spreads. + """Class used by the extended_spread attribute of the Spread class for alternate spreads. + + attributes: + affiliate_id: Affiliate ID + point_spread_away: Away team point spread + point_spread_away_delta: Change in odds compared to previous + point_spread_home: Home team point spread + point_spread_home_delta: Change in odds compared to previous + point_spread_away_money: Away team odds + point_spread_away_money_delta: Change in odds compared to previous + point_spread_home_money: Home team odds + point_spread_home_money_delta: Change in odds compared to previous """ affiliate_id: int @@ -81,7 +117,19 @@ class SpreadElement(BaseModel): class Spread(ExtendedLine): - """Class with attributes specific to spread bets. Includes alternate spreads.""" + """Class with attributes specific to spread bets. Includes alternate spreads. Inherits from ExtendedLine. + + attributes: + point_spread_away: Away team point spread + point_spread_away_delta: Change in odds compared to previous + point_spread_home: Home team point spread + point_spread_home_delta: Change in odds compared to previous + point_spread_away_money: Away team odds + point_spread_away_money_delta: Change in odds compared to previous + point_spread_home_money: Home team odds + point_spread_home_money_delta: Change in odds compared to previous + extended_spreads: list of SpreadElement + """ point_spread_away: Union[StrictInt, StrictFloat] = None point_spread_away_delta: Union[StrictInt, StrictFloat] = None @@ -107,15 +155,30 @@ class Spread(ExtendedLine): class SpreadPeriod(Spread): - """Spread class for different periods / quarters / halves of a game.""" + """Spread class for different periods / quarters / halves of a game. Inherits from Spread. + + attributes: + period_id: Period ID + period_description: Period description + """ period_id: int period_description: str class TotalElement(BaseModel): - """Class used by the extended_total attribute of the Total class for alternate - totals. + """Class used by the extended_total attribute of the Total class for alternate spreads. + + attributes: + affiliate_id: Affiliate ID + total_over: Over total + total_over_delta: Change in odds compared to previous + total_under: Under total + total_under_delta: Change in odds compared to previous + total_over_money: Over odds + total_over_money_delta: Change in odds compared to previous + total_under_money: Under odds + total_under_money_delta: Change in odds compared to previous """ affiliate_id: int @@ -142,7 +205,19 @@ class TotalElement(BaseModel): class Total(ExtendedLine): - """Class with attributes specific to total bets. Includes alternate totals.""" + """Class with attributes specific to total bets. Includes alternate totals. Inherits from ExtendedLine. + + attributes: + total_over: Over total + total_over_delta: Change in odds compared to previous + total_under: Under total + total_under_delta: Change in odds compared to previous + total_over_money: Over odds + total_over_money_delta: Change in odds compared to previous + total_under_money: Under odds + total_under_money_delta: Change in odds compared to previous + extended_totals: list of TotalElement + """ total_over: Union[StrictInt, StrictFloat] = None total_over_delta: Union[StrictInt, StrictFloat] = None @@ -168,7 +243,12 @@ class Total(ExtendedLine): class TotalPeriod(Total): - """Total class for different periods / quarters / halves of a game.""" + """Total class for different periods / quarters / halves of a game. Inherits from Total. + + attributes: + period_id: Period ID + period_description: Period description + """ period_id: int period_description: str diff --git a/rundown/resources/lineperiods.py b/rundown/resources/lineperiods.py index 4d168c3..d807ffe 100644 --- a/rundown/resources/lineperiods.py +++ b/rundown/resources/lineperiods.py @@ -10,7 +10,18 @@ class LinePeriods(BaseModel): - """Class used to aggregate lines for different periods of a game or event.""" + """Class used to aggregate lines for different periods of a game or event. + + attributes: + period_full_game: list of Period subclass + period_first_half: list of Period subclass + period_second_half: list of Period subclass + period_first_period: list of Period subclass + period_second_period: list of Period subclass + period_third_period: list of Period subclass + period_fourth_period: list of Period subclass + period_live_full_game: list of Period subclass + """ period_full_game: list[Union[MoneylinePeriod, SpreadPeriod, TotalPeriod]] period_first_half: list[Union[MoneylinePeriod, SpreadPeriod, TotalPeriod]] = [] diff --git a/rundown/resources/schedule.py b/rundown/resources/schedule.py index e10b738..5f5e6c6 100644 --- a/rundown/resources/schedule.py +++ b/rundown/resources/schedule.py @@ -6,7 +6,14 @@ class BaseSchedule(BaseModel): - """Schedule class used by Event resource.""" + """Schedule class used by Event resource. + + attributes: + season_type: Type of season + season_year: Year of season + event_name: Event name + attendance: Attendance + """ season_type: str season_year: int @@ -15,7 +22,28 @@ class BaseSchedule(BaseModel): class Schedule(BaseSchedule): - """Schedule class containing more attributes which is used by Rundown.schedule.""" + """Schedule class containing more attributes which is used by Rundown.schedule. Inherits from BaseSchedule. + + attributes: + id: Schedule ID + event_uuid: Event UUID + event_id: Event ID + sport_id: Sport ID + away_team_id: Away team ID + home_team_id: Home team ID + away_team: Away team + home_team: Home team + date_event: Event date + neutral_site: Is neutral site + conference_competition: Is conference competition + away_score: Away team score + home_score: Home team score + league_name: league name + event_location: Event location + updated_at: Time updated at + event_status: Event status + event_status_detail: Event status detail + """ id: int event_uuid: str diff --git a/rundown/resources/sport.py b/rundown/resources/sport.py index 32b6896..083ceb0 100644 --- a/rundown/resources/sport.py +++ b/rundown/resources/sport.py @@ -4,7 +4,12 @@ class Sport(BaseModel): - """Sport class returned by Rundown.sports.""" + """Sport class returned by Rundown.sports. + + attributes: + sport_name: Sport name + sport_id: Sport ID + """ sport_name: str sport_id: int diff --git a/rundown/resources/sportsbook.py b/rundown/resources/sportsbook.py index f5950f2..b9177f3 100644 --- a/rundown/resources/sportsbook.py +++ b/rundown/resources/sportsbook.py @@ -4,7 +4,13 @@ class Sportsbook(BaseModel): - """Sportsbook class returned by Rundown.sportsbooks.""" + """Sportsbook class returned by Rundown.sportsbooks. + + attributes: + affiliate_name: Sportsbook name + affiliate_id: Sportsbook ID + affiliate_url: Sportsbook URL + """ affiliate_name: str affiliate_id: int diff --git a/rundown/resources/team.py b/rundown/resources/team.py index 2f49920..37453e0 100644 --- a/rundown/resources/team.py +++ b/rundown/resources/team.py @@ -4,7 +4,14 @@ class BaseTeam(BaseModel): - """Base team class used by Rundown.team.""" + """Base team class used by Rundown.team. + + attributes: + team_id: Team ID + name: Team name + mascot: Mascot + abbreviation: Team abbreviation + """ team_id: int name: str @@ -14,7 +21,13 @@ class BaseTeam(BaseModel): class Team(BaseTeam): """Extended team class used by the 'teams_normalized' attribute in the Event - resource. + resource. Inherits from BaseTeam. + + attributes: + ranking: Ranking + record: Record + is_away: Is away + is_home: Is home """ ranking: int @@ -24,7 +37,14 @@ class Team(BaseTeam): class TeamDeprecated(BaseModel): - """Deprecated team class used by the 'team' attribute in the Event resource.""" + """Deprecated team class used by the 'team' attribute in the Event resource. + + attributes: + team_id: Team ID + team_normalized_id: Team Normalized ID + name: Team name + is_away: Is away + """ team_id: int team_normalized_id: int diff --git a/rundown/rundown.py b/rundown/rundown.py index a387f28..b1fcd80 100644 --- a/rundown/rundown.py +++ b/rundown/rundown.py @@ -63,22 +63,6 @@ class Rundown: """The Rundown REST API client class supporting user configuration. Both RapidAPI.com and TheRundown.io are supported. - - Args: - api_key: The API key to use. - api_provider: The API provider. Must be either 'rundown' or 'rapidapi' - (case insensitive). - timezone: Your preferred timezone. - The following formats are accepted: - - A str describing a timezone, similar to ‘US/Pacific’, or ‘Europe/Berlin’. - - A str in ISO 8601 style, as in ‘+07:00’. - - A str, one of the following: ‘local’, ‘utc’, ‘UTC’. - - timezone will be used to format responses from the API. - - Attributes: - sport_names (dict[str, int]): Sports names and their IDs. - timezone (str): Your preferred timezone. """ def __init__( @@ -88,6 +72,23 @@ def __init__( timezone: str = "local", refresh_cached_data: bool = False, ): + """ + Args: + api_key: The API key to use. + api_provider: The API provider. Must be either 'rundown' or 'rapidapi' + (case insensitive). + timezone: Your preferred timezone. + The following formats are accepted: + - A str describing a timezone, similar to ‘US/Pacific’, or ‘Europe/Berlin’. + - A str in ISO 8601 style, as in ‘+07:00’. + - A str, one of the following: ‘local’, ‘utc’, ‘UTC’. + + timezone will be used to format responses from the API. + + Attributes: + sport_names (dict[str, int]): Sports names and their IDs. + timezone (str): Your preferred timezone. + """ self._auth = _Base.factory(api_provider.lower(), api_key) self._session = requests.session() self._session.headers.update(self._auth.headers) diff --git a/rundown/static/sports.yaml b/rundown/static/sports.yaml index cdb11dc..9364204 100644 --- a/rundown/static/sports.yaml +++ b/rundown/static/sports.yaml @@ -15,7 +15,7 @@ sports: sport_name: UFC/MMA - sport_id: 8 sport_name: WNBA -- sport_id: 9 - sport_name: CFL - sport_id: 10 sport_name: MLS +- sport_id: 11 + sport_name: EPL diff --git a/rundown/static/sportsbooks.yaml b/rundown/static/sportsbooks.yaml index a7eb52d..076f6d8 100644 --- a/rundown/static/sportsbooks.yaml +++ b/rundown/static/sportsbooks.yaml @@ -1,7 +1,7 @@ affiliates: - affiliate_id: 1 affiliate_name: 5Dimes - affiliate_url: https://www.5dimes.eu/ + affiliate_url: https://bit.ly/3rKIuBh - affiliate_id: 3 affiliate_name: Pinnacle affiliate_url: https://www.pinnacle.com/en/rtn @@ -13,7 +13,7 @@ affiliates: affiliate_url: https://sportsbook.draftkings.com/ - affiliate_id: 6 affiliate_name: BetOnline - affiliate_url: https://betonline.ag/ + affiliate_url: http://bit.ly/3oogty4 - affiliate_id: 20 affiliate_name: Pointsbet affiliate_url: https://pointsbet.com/ @@ -31,22 +31,22 @@ affiliates: affiliate_url: https://www.justbet.co/sportsbook-betting - affiliate_id: 4 affiliate_name: SportsBetting - affiliate_url: https://www.sportsbetting.ag/ + affiliate_url: http://bit.ly/2JT73M1 - affiliate_id: 9 affiliate_name: betcris - affiliate_url: https://www.betcris.com/en/sportsbook -- affiliate_id: 15 - affiliate_name: TigerGaming - affiliate_url: https://sportsbook.tigergaming.com/ + affiliate_url: http://bit.ly/3rAZdGQ - affiliate_id: 14 affiliate_name: Intertops - affiliate_url: https://sports.intertops.eu/ + affiliate_url: http://bit.ly/2XkXdpa - affiliate_id: 12 affiliate_name: Bodog - affiliate_url: https://www.bodog.eu/ + affiliate_url: https://bit.ly/2Z5uFkw - affiliate_id: 18 affiliate_name: YouWager - affiliate_url: https://www.youwager.eu/sportsbook -- affiliate_id: 17 - affiliate_name: RedZone - affiliate_url: https://www.redzonesports.bet/en/sports/ + affiliate_url: http://bit.ly/2Z1s37j +- affiliate_id: 21 + affiliate_name: Unibet + affiliate_url: https://www.unibet.com/ +- affiliate_id: 22 + affiliate_name: BetMGM + affiliate_url: https://promo.nj.betmgm.com/en/promo/geolocator?orh=sports.betmgm.com From 386c85e8d2e4b643ffcf518b046199781cb2a925 Mon Sep 17 00:00:00 2001 From: JeMorriso Date: Tue, 29 Jun 2021 09:57:16 -0700 Subject: [PATCH 8/8] Update docs --- docs/code-reference/resources.md | 11 +++++++++++ docs/code-reference/rundown.md | 2 ++ docs/favicon.png | Bin 0 -> 806 bytes docs/index.md | 21 +++++++++++++++++++++ 4 files changed, 34 insertions(+) create mode 100644 docs/code-reference/resources.md create mode 100644 docs/code-reference/rundown.md create mode 100644 docs/favicon.png create mode 100644 docs/index.md diff --git a/docs/code-reference/resources.md b/docs/code-reference/resources.md new file mode 100644 index 0000000..f28ad11 --- /dev/null +++ b/docs/code-reference/resources.md @@ -0,0 +1,11 @@ +# Resources Module +::: rundown.resources.date +::: rundown.resources.event +::: rundown.resources.events +::: rundown.resources.line +::: rundown.resources.lineperiods +::: rundown.resources.schedule +::: rundown.resources.sport +::: rundown.resources.sportsbook +::: rundown.resources.team +::: rundown.resources.validators diff --git a/docs/code-reference/rundown.md b/docs/code-reference/rundown.md new file mode 100644 index 0000000..894e43d --- /dev/null +++ b/docs/code-reference/rundown.md @@ -0,0 +1,2 @@ +# Rundown Module +::: rundown.rundown diff --git a/docs/favicon.png b/docs/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..1066c5f09d30539925bb7e1df266877424809aad GIT binary patch literal 806 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyEa{HEjtmSN`?>!lvVtU&J%W50 z7^>757#dm_7=8hT8eT9klo~KFyh>nTu$sZZAYL$MSD+081EXeuPlzi}L2^XID8e5C z|NsB5@mzTu7+8rVL4Lsu41yX;l01z33*WwZ{ovA`>9KMwwZDE}Eeu^OW_vf`m%L#EG4fk{dQ`+GxB;POP)lMh`oxvM+U0dhYej=M z&myN#-Zc($Bbh}rvNB)4XbOE{_~_HNeT)%}ipuL642_PhZn${l3eOv_;tkR|I%_X9 zZ0*&(!H{abfvLLPCFY*UvDF7Io}4Mz&m Python client library for the sports betting API provided by [TheRundown.io](https://therundown.io). + +TheRundown Python maps the REST API's endpoints to functions that return nested data objects. + +## Features +- Full support for each of the API's endpoints +- Set your preferred timezone and all response data will be converted to that timezone +- Search by sport / league name instead of ID +- Sportsbook lines keyed by sportsbook name instead of ID +- Work with objects instead of raw text +- Response data is validated using [Pydantic](https://pydantic-docs.helpmanual.io/) + +You can learn more about the REST API at [RapidAPI.com](https://rapidapi.com/therundown/api/therundown/) + +# Installation +`pip install therundown-python` + +Python 3.8+ is required. + +