Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 1 addition & 48 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions docs/code-reference/resources.md
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions docs/code-reference/rundown.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Rundown Module
::: rundown.rundown
Binary file added docs/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Overview
> 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.


32 changes: 32 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -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
Loading