Skip to main content
# pyTBA
Python 3 Blue Alliance API Layer for parsing FIRST Robotics Competition event data.
https://www.thebluealliance.com/

## Features:
* Simple and lightweight API for downloading and parsing BlueAlliance data
* Data caching faster performance
* OPR / Individual Stats calculation

## Adding it to your code:
To install with `pip`:
```bash
pip install pyTBA
```

To add PyTBA to your project, import the `pytba.api` module, and set an app id:

```python
from pytba import api as tba

tba.set_api_key("<Your Name>", "<App Name>", "<App Version>")
```
## Basic Usage:
The most basic usage is to make a query to an arbitrary URL in the TBA API.
This is done by:
```python
tba.tba_get('relative/url/goes/here')
```
PyTBA makes a request to the TBA API (https://www.thebluealliance.com/api/v2/)
and returns the response, stored as a `dict`. (See [TBA API docs](https://www.thebluealliance.com/apidocs) for more information about keys)

PyTBA can also retrieve data for entire events:
```python
tba.event_get('<Event Code>')
```
This returns an `Event` object, which groups together location, team, match, awards, and rankings data.
For example, to retrieve a list of `match` models from an `Event`:
```python
event = tba.event_get('2016chcmp')
matches = event.matches
```

More advanced usage can be found in the documentation in the source code.

##Modules required:
* `requests`
* `cachecontrol`
* `dpath`
* `numpy` - for OPR calculation

###Note about older versions:
If you are updating from an older version (with the single blualliance.py file), be aware that the package structure has become more modularized. The core API code is now in the `pytba.api` module. The `Event` class is now under `pytba.models`. The decorators and utility methods are now under `pytba.util`, and OPR calcuation is now under `pytba.stat`. Check out [the init release](https://github.com/Thing342/pyTBA/releases/tag/init) if you need to clone the older code.



Release files for pyTBA 1.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyTBA 1.2.1
File Size Uploaded
pyTBA-1.2.1.tar.gz 12.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyTBA 1.2.1
File Interpreter ABI Platform
pyTBA-1.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 29.7 kB

Release files / pyTBA-1.2.1.tar.gz

Download URL pyTBA-1.2.1.tar.gz
Size 12.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d35ec5adb3c52719863f43debd966e713e759d5c6534ac220d0258ef859b5a1f
BLAKE2b-256 checksum
How to use checksums
b4387d30febcdde6acdf4e25ad937be428bea887c95844916ce5dfabf96e5803
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pyTBA-1.2.1-py3-none-any.whl

Download URL pyTBA-1.2.1-py3-none-any.whl
Size 17.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f861bb7e59435fbcabc7615e41ee2280d3f6f2bdbee8df34efba2c8054e9d208
BLAKE2b-256 checksum
How to use checksums
c86deac02fb5fb9ee9b25da65270732cc4a02f183ed8dc0af38bf975b7c0544e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.2.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page