Name | formula-fantasy JSON |
Version |
1.0.4
JSON |
| download |
home_page | https://github.com/yourusername/formula-fantasy |
Summary | A simple Python library for fetching F1 Fantasy driver and constructor data |
upload_time | 2025-08-10 23:54:57 |
maintainer | None |
docs_url | None |
author | F1 Fantasy Data Team |
requires_python | >=3.7 |
license | MIT License
Copyright (c) 2025 Josh Bruce
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
|
keywords |
f1
formula1
fantasy
racing
motorsport
api
data
statistics
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Formula Fantasy Python Library 🏎️
A simple and powerful Python library for fetching F1 Fantasy data. Get driver and constructor points, detailed breakdowns, and statistics with just one line of code.
## ✨ Features
- **Simple API**: Single command to get points data
- **Comprehensive Data**: Access all driver and constructor fantasy points
- **Detailed Breakdowns**: Get specific point categories (overtakes, DotD, fastest lap, etc.)
- **Latest Data**: Always up-to-date with the most recent race weekend
- **Historical Data**: Access data from any previous race round
- **CLI Interface**: Command-line tools for quick queries
- **Live GitHub Data**: Fetches real-time data from the official F1 Fantasy scraper
## 🚀 Quick Start
### Installation
```bash
pip install formula-fantasy
```
### Basic Usage
```python
from formula_fantasy import get_driver_points, get_constructor_points
# Get driver points for latest race
points = get_driver_points("VER") # Max Verstappen latest race
print(f"VER latest points: {points}")
# Get constructor points for a specific round
points = get_constructor_points("RBR", "14") # Red Bull Racing round 14
print(f"RBR round 14: {points} points")
# Get detailed breakdown
from formula_fantasy import get_driver_breakdown
breakdown = get_driver_breakdown("VER", "14", "race")
print(f"VER overtakes: {breakdown['overtakeBonus']}")
# Get specific point type
overtakes = get_driver_breakdown("VER", "14", "race", "overtakeBonus")
print(f"VER overtake bonus: {overtakes}")
```
## 📖 API Reference
### Core Functions
#### `get_driver_points(abbreviation, round="latest")`
Get total fantasy points for a driver in a specific round.
**Parameters:**
- `abbreviation` (str): Driver abbreviation ("VER", "HAM", "NOR", etc.)
- `round` (str/int): Round number or "latest" (default: "latest")
**Returns:** int - Total fantasy points
**Examples:**
```python
get_driver_points("VER", "14") # Verstappen round 14
get_driver_points("NOR", "latest") # Norris latest round
get_driver_points("HAM", 12) # Hamilton round 12
```
#### `get_constructor_points(abbreviation, round="latest")`
Get total fantasy points for a constructor in a specific round.
**Parameters:**
- `abbreviation` (str): Constructor abbreviation ("RBR", "MCL", "FER", etc.)
- `round` (str/int): Round number or "latest" (default: "latest")
**Returns:** int - Total fantasy points
**Examples:**
```python
get_constructor_points("RBR", "14") # Red Bull Racing round 14
get_constructor_points("MCL", "latest") # McLaren latest round
```
#### `get_driver_breakdown(abbreviation, round="latest", session="race", points_type=None)`
Get detailed points breakdown for a driver.
**Parameters:**
- `abbreviation` (str): Driver abbreviation
- `round` (str/int): Round number or "latest" (default: "latest")
- `session` (str): "race", "sprint", or "qualifying" (default: "race")
- `points_type` (str, optional): Specific point type to get
**Returns:**
- If `points_type` specified: int (specific point value)
- Otherwise: dict (complete breakdown)
**Available point types:**
- `"dotd"` - Driver of the Day (10 points)
- `"position"` - Position points
- `"qualifyingPosition"` - Qualifying position points
- `"fastestLap"` - Fastest lap bonus
- `"overtakeBonus"` - Overtaking points
- `"positionsGained"` - Positions gained
- `"positionsLost"` - Positions lost
- `"disqualificationPenalty"` - Penalty points
**Examples:**
```python
# Get full breakdown
breakdown = get_driver_breakdown("VER", "14", "race")
# Returns: {"dotd": 0, "position": 10, "overtakeBonus": 7, ...}
# Get specific point type
dotd_points = get_driver_breakdown("VER", "14", "race", "dotd")
# Returns: 0
# Get sprint breakdown
sprint_breakdown = get_driver_breakdown("VER", "14", "sprint")
```
#### `get_constructor_breakdown(abbreviation, round="latest", session="race", points_type=None)`
Get detailed points breakdown for a constructor.
**Parameters:** Same as `get_driver_breakdown`
**Constructor point types:**
- `"position"` - Position points
- `"overtakes"` - Total overtakes
- `"fastestPitStop"` - Fastest pit stop bonus
- `"pitStopBonus"` - Pit stop bonus
- `"worldRecordBonus"` - World record bonus
- `"positionsGained"` - Positions gained
- `"positionsLost"` - Positions lost
#### `get_driver_info(abbreviation)` / `get_constructor_info(abbreviation)`
Get complete information including season totals, value, team, etc.
**Returns:** dict - Complete data structure
**Examples:**
```python
info = get_driver_info("VER")
print(info["team"]) # "Red Bull Racing"
print(info["seasonTotalPoints"]) # 335
print(info["value"]) # "28.2M"
print(info["percentagePicked"]) # 16
constructor_info = get_constructor_info("RBR")
print(constructor_info["seasonTotalPoints"]) # 568
```
#### Utility Functions
```python
from formula_fantasy import list_drivers, list_constructors, get_latest_round
drivers = list_drivers()
# Returns: ["ALB", "ALO", "ANT", "BEA", "BOR", ...]
constructors = list_constructors()
# Returns: ["ALP", "AMR", "FER", "HAS", "MCL", ...]
latest = get_latest_round()
# Returns: "15"
```
## 🖥️ Command Line Interface
The library includes a powerful CLI for quick data access:
### Basic Commands
```bash
# Driver points
python -m formula_fantasy.cli VER 14 # VER round 14: 11 points
python -m formula_fantasy.cli NOR latest # NOR latest round: 0 points
# Constructor points
python -m formula_fantasy.cli RBR 14 # RBR round 14: 39 points
# Specific breakdowns
python -m formula_fantasy.cli VER 14 race overtakeBonus # VER overtakeBonus: 7
python -m formula_fantasy.cli RBR 14 race overtakes # RBR overtakes: 7
```
### Advanced CLI Options
```bash
# Get full breakdown
python -m formula_fantasy.cli VER 14 --breakdown
# Shows: VER race breakdown for round 14: {dotd: 0, position: 10, ...}
# Get driver/constructor info
python -m formula_fantasy.cli VER --info
# Shows: Driver: Max Verstappen, Team: Red Bull Racing, Season: 335 points
# List available options
python -m formula_fantasy.cli --drivers # List all drivers
python -m formula_fantasy.cli --constructors # List all constructors
```
## 🏎️ Available Drivers & Constructors
### Drivers
```
ALB - Alexander Albon ANT - Antonelli BEA - Bearman
ALO - Fernando Alonso BOR - Valtteri Bottas COL - Colapinto
DOO - Doohan GAS - Pierre Gasly HAD - Hadjar
HAM - Lewis Hamilton HUL - Nico Hulkenberg LAW - Liam Lawson
LEC - Charles Leclerc NOR - Lando Norris OCO - Esteban Ocon
PIA - Oscar Piastri RUS - George Russell SAI - Carlos Sainz Jr
STR - Lance Stroll TSU - Yuki Tsunoda VER - Max Verstappen
```
### Constructors
```
ALP - Alpine AMR - Aston Martin FER - Ferrari HAS - Haas
MCL - McLaren MER - Mercedes RB - Racing Bulls RBR - Red Bull Racing
SAU - Sauber WIL - Williams
```
## 🔍 Data Structure
### Driver Data Structure
```python
{
"driverId": "maxverstappendriver",
"name": "maxverstappendriver",
"displayName": "maxverstappen",
"abbreviation": "VER",
"team": "Red Bull Racing",
"position": 3,
"value": "28.2M",
"seasonTotalPoints": 335,
"percentagePicked": 16,
"isInactive": false,
"races": [
{
"round": "14",
"raceName": "Hungary",
"totalPoints": 11,
"race": {
"dotd": 0,
"position": 10,
"qualifyingPosition": 0,
"fastestLap": 0,
"overtakeBonus": 7,
"positionsGained": 0,
"positionsLost": -1,
"disqualificationPenalty": 0
},
"qualifying": {
"position": 3,
"disqualificationPenalty": 0
}
}
],
"extractedAt": "2025-08-10T20:17:09.831Z"
}
```
## 🎯 Usage Examples
### Fantasy Team Analysis
```python
from formula_fantasy import *
# Analyze your fantasy team performance
my_team = {
"drivers": ["NOR", "PIA", "VER", "RUS", "HAM"],
"constructors": ["MCL", "RBR"]
}
print("=== My Fantasy Team Performance ===")
total_points = 0
for driver in my_team["drivers"]:
points = get_driver_points(driver, "14")
info = get_driver_info(driver)
total_points += points
print(f"{driver}: {points} pts (${info['value']}, {info['percentagePicked']}% picked)")
for constructor in my_team["constructors"]:
points = get_constructor_points(constructor, "14")
info = get_constructor_info(constructor)
total_points += points
print(f"{constructor}: {points} pts (${info['value']}, {info['percentagePicked']}% picked)")
print(f"Total team points: {total_points}")
```
### Driver Performance Analysis
```python
# Compare drivers over multiple rounds
drivers = ["VER", "NOR", "HAM", "RUS"]
rounds = ["12", "13", "14"]
print("Driver Performance Comparison:")
print("Driver\\tRound 12\\tRound 13\\tRound 14\\tAvg")
for driver in drivers:
points = []
for round_num in rounds:
pts = get_driver_points(driver, round_num)
points.append(pts)
avg = sum(points) / len(points)
print(f"{driver}\\t{points[0]}\\t{points[1]}\\t{points[2]}\\t{avg:.1f}")
```
### Overtaking Kings Analysis
```python
# Find the best overtakers
drivers = list_drivers()
round_num = "14"
print(f"Top Overtakers - Round {round_num}:")
overtake_data = []
for driver in drivers:
try:
overtakes = get_driver_breakdown(driver, round_num, "race", "overtakeBonus")
if overtakes > 0:
info = get_driver_info(driver)
overtake_data.append((driver, info['team'], overtakes))
except:
continue
# Sort by overtake points
overtake_data.sort(key=lambda x: x[2], reverse=True)
for i, (driver, team, points) in enumerate(overtake_data[:10], 1):
print(f"{i:2d}. {driver} ({team}): +{points} overtake points")
```
## 🔄 Data Updates
The library fetches data from GitHub in real-time, so you always get:
- ✅ Latest race results
- ✅ Most current driver/constructor standings
- ✅ Updated fantasy point calculations
- ✅ Recent team changes and driver swaps
Data is automatically updated after each race weekend.
## ⚠️ Error Handling
```python
from formula_fantasy import F1FantasyError
try:
points = get_driver_points("INVALID", "14")
except F1FantasyError as e:
print(f"Error: {e}")
# Handle the error appropriately
```
Common error scenarios:
- Invalid driver/constructor abbreviation
- Round data not available
- Network connectivity issues
- GitHub API rate limiting
## 🛠️ Advanced Usage
### Custom Round Names
```python
# The library also supports race names (when available)
points = get_driver_points("VER", "Hungary") # If supported
points = get_driver_points("VER", "14") # Recommended approach
```
### Session-Specific Analysis
```python
# Compare qualifying vs race performance
driver = "NOR"
round_num = "14"
qualifying = get_driver_breakdown(driver, round_num, "qualifying")
race = get_driver_breakdown(driver, round_num, "race")
sprint = get_driver_breakdown(driver, round_num, "sprint")
print(f"{driver} Round {round_num}:")
print(f"Qualifying: {qualifying.get('position', 0)} pts")
print(f"Race: {race.get('position', 0)} pts")
print(f"Sprint: {sprint.get('position', 0)} pts")
```
## 🌟 Pro Tips
1. **Use abbreviations consistently** - Always use 3-letter codes (VER, HAM, NOR)
2. **Cache expensive calls** - Store driver/constructor info if calling repeatedly
3. **Handle missing data gracefully** - Not all rounds have sprint sessions
4. **Check latest round** - Use `get_latest_round()` to know what data is available
5. **Batch CLI operations** - Use shell scripts for multiple queries
## 📊 Data Source
This library fetches data from the official F1 Fantasy scraper repository:
- **GitHub Repository**: [JoshCBruce/fantasy-data](https://github.com/JoshCBruce/fantasy-data)
- **Data Updates**: After each race weekend
- **Coverage**: Complete 2025 F1 season
- **Accuracy**: Official F1 Fantasy point calculations
## 🤝 Contributing
Found a bug or want to contribute?
1. Check the [issues page](https://github.com/yourusername/formula-fantasy/issues)
2. Fork the repository
3. Make your changes
4. Submit a pull request
## 📜 License
MIT License - feel free to use in your own projects!
---
**Happy F1 Fantasy analysis! 🏎️📊**
Raw data
{
"_id": null,
"home_page": "https://github.com/yourusername/formula-fantasy",
"name": "formula-fantasy",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "F1 Fantasy Data Team <noreply@f1fantasy.dev>",
"keywords": "f1, formula1, fantasy, racing, motorsport, api, data, statistics",
"author": "F1 Fantasy Data Team",
"author_email": "F1 Fantasy Data Team <noreply@f1fantasy.dev>",
"download_url": "https://files.pythonhosted.org/packages/60/08/9a9acaa979ec1332c3bc85bbe69a45d06e9d390eb13a9a271c174536f9aa/formula_fantasy-1.0.4.tar.gz",
"platform": null,
"description": "# Formula Fantasy Python Library \ud83c\udfce\ufe0f\n\nA simple and powerful Python library for fetching F1 Fantasy data. Get driver and constructor points, detailed breakdowns, and statistics with just one line of code.\n\n## \u2728 Features\n\n- **Simple API**: Single command to get points data\n- **Comprehensive Data**: Access all driver and constructor fantasy points\n- **Detailed Breakdowns**: Get specific point categories (overtakes, DotD, fastest lap, etc.)\n- **Latest Data**: Always up-to-date with the most recent race weekend\n- **Historical Data**: Access data from any previous race round\n- **CLI Interface**: Command-line tools for quick queries\n- **Live GitHub Data**: Fetches real-time data from the official F1 Fantasy scraper\n\n## \ud83d\ude80 Quick Start\n\n### Installation\n\n```bash\npip install formula-fantasy\n```\n\n### Basic Usage\n\n```python\nfrom formula_fantasy import get_driver_points, get_constructor_points\n\n# Get driver points for latest race\npoints = get_driver_points(\"VER\") # Max Verstappen latest race\nprint(f\"VER latest points: {points}\")\n\n# Get constructor points for a specific round\npoints = get_constructor_points(\"RBR\", \"14\") # Red Bull Racing round 14\nprint(f\"RBR round 14: {points} points\")\n\n# Get detailed breakdown\nfrom formula_fantasy import get_driver_breakdown\n\nbreakdown = get_driver_breakdown(\"VER\", \"14\", \"race\")\nprint(f\"VER overtakes: {breakdown['overtakeBonus']}\")\n\n# Get specific point type\novertakes = get_driver_breakdown(\"VER\", \"14\", \"race\", \"overtakeBonus\")\nprint(f\"VER overtake bonus: {overtakes}\")\n```\n\n## \ud83d\udcd6 API Reference\n\n### Core Functions\n\n#### `get_driver_points(abbreviation, round=\"latest\")`\nGet total fantasy points for a driver in a specific round.\n\n**Parameters:**\n- `abbreviation` (str): Driver abbreviation (\"VER\", \"HAM\", \"NOR\", etc.)\n- `round` (str/int): Round number or \"latest\" (default: \"latest\")\n\n**Returns:** int - Total fantasy points\n\n**Examples:**\n```python\nget_driver_points(\"VER\", \"14\") # Verstappen round 14\nget_driver_points(\"NOR\", \"latest\") # Norris latest round\nget_driver_points(\"HAM\", 12) # Hamilton round 12\n```\n\n#### `get_constructor_points(abbreviation, round=\"latest\")`\nGet total fantasy points for a constructor in a specific round.\n\n**Parameters:**\n- `abbreviation` (str): Constructor abbreviation (\"RBR\", \"MCL\", \"FER\", etc.)\n- `round` (str/int): Round number or \"latest\" (default: \"latest\")\n\n**Returns:** int - Total fantasy points\n\n**Examples:**\n```python\nget_constructor_points(\"RBR\", \"14\") # Red Bull Racing round 14\nget_constructor_points(\"MCL\", \"latest\") # McLaren latest round\n```\n\n#### `get_driver_breakdown(abbreviation, round=\"latest\", session=\"race\", points_type=None)`\nGet detailed points breakdown for a driver.\n\n**Parameters:**\n- `abbreviation` (str): Driver abbreviation\n- `round` (str/int): Round number or \"latest\" (default: \"latest\")\n- `session` (str): \"race\", \"sprint\", or \"qualifying\" (default: \"race\")\n- `points_type` (str, optional): Specific point type to get\n\n**Returns:** \n- If `points_type` specified: int (specific point value)\n- Otherwise: dict (complete breakdown)\n\n**Available point types:**\n- `\"dotd\"` - Driver of the Day (10 points)\n- `\"position\"` - Position points\n- `\"qualifyingPosition\"` - Qualifying position points\n- `\"fastestLap\"` - Fastest lap bonus\n- `\"overtakeBonus\"` - Overtaking points\n- `\"positionsGained\"` - Positions gained\n- `\"positionsLost\"` - Positions lost\n- `\"disqualificationPenalty\"` - Penalty points\n\n**Examples:**\n```python\n# Get full breakdown\nbreakdown = get_driver_breakdown(\"VER\", \"14\", \"race\")\n# Returns: {\"dotd\": 0, \"position\": 10, \"overtakeBonus\": 7, ...}\n\n# Get specific point type\ndotd_points = get_driver_breakdown(\"VER\", \"14\", \"race\", \"dotd\")\n# Returns: 0\n\n# Get sprint breakdown\nsprint_breakdown = get_driver_breakdown(\"VER\", \"14\", \"sprint\")\n```\n\n#### `get_constructor_breakdown(abbreviation, round=\"latest\", session=\"race\", points_type=None)`\nGet detailed points breakdown for a constructor.\n\n**Parameters:** Same as `get_driver_breakdown`\n\n**Constructor point types:**\n- `\"position\"` - Position points\n- `\"overtakes\"` - Total overtakes\n- `\"fastestPitStop\"` - Fastest pit stop bonus\n- `\"pitStopBonus\"` - Pit stop bonus\n- `\"worldRecordBonus\"` - World record bonus\n- `\"positionsGained\"` - Positions gained\n- `\"positionsLost\"` - Positions lost\n\n#### `get_driver_info(abbreviation)` / `get_constructor_info(abbreviation)`\nGet complete information including season totals, value, team, etc.\n\n**Returns:** dict - Complete data structure\n\n**Examples:**\n```python\ninfo = get_driver_info(\"VER\")\nprint(info[\"team\"]) # \"Red Bull Racing\"\nprint(info[\"seasonTotalPoints\"]) # 335\nprint(info[\"value\"]) # \"28.2M\"\nprint(info[\"percentagePicked\"]) # 16\n\nconstructor_info = get_constructor_info(\"RBR\")\nprint(constructor_info[\"seasonTotalPoints\"]) # 568\n```\n\n#### Utility Functions\n\n```python\nfrom formula_fantasy import list_drivers, list_constructors, get_latest_round\n\ndrivers = list_drivers()\n# Returns: [\"ALB\", \"ALO\", \"ANT\", \"BEA\", \"BOR\", ...]\n\nconstructors = list_constructors() \n# Returns: [\"ALP\", \"AMR\", \"FER\", \"HAS\", \"MCL\", ...]\n\nlatest = get_latest_round()\n# Returns: \"15\"\n```\n\n## \ud83d\udda5\ufe0f Command Line Interface\n\nThe library includes a powerful CLI for quick data access:\n\n### Basic Commands\n\n```bash\n# Driver points\npython -m formula_fantasy.cli VER 14 # VER round 14: 11 points\npython -m formula_fantasy.cli NOR latest # NOR latest round: 0 points\n\n# Constructor points \npython -m formula_fantasy.cli RBR 14 # RBR round 14: 39 points\n\n# Specific breakdowns\npython -m formula_fantasy.cli VER 14 race overtakeBonus # VER overtakeBonus: 7\npython -m formula_fantasy.cli RBR 14 race overtakes # RBR overtakes: 7\n```\n\n### Advanced CLI Options\n\n```bash\n# Get full breakdown\npython -m formula_fantasy.cli VER 14 --breakdown\n# Shows: VER race breakdown for round 14: {dotd: 0, position: 10, ...}\n\n# Get driver/constructor info\npython -m formula_fantasy.cli VER --info\n# Shows: Driver: Max Verstappen, Team: Red Bull Racing, Season: 335 points\n\n# List available options\npython -m formula_fantasy.cli --drivers # List all drivers\npython -m formula_fantasy.cli --constructors # List all constructors\n```\n\n## \ud83c\udfce\ufe0f Available Drivers & Constructors\n\n### Drivers\n```\nALB - Alexander Albon ANT - Antonelli BEA - Bearman\nALO - Fernando Alonso BOR - Valtteri Bottas COL - Colapinto \nDOO - Doohan GAS - Pierre Gasly HAD - Hadjar\nHAM - Lewis Hamilton HUL - Nico Hulkenberg LAW - Liam Lawson\nLEC - Charles Leclerc NOR - Lando Norris OCO - Esteban Ocon\nPIA - Oscar Piastri RUS - George Russell SAI - Carlos Sainz Jr\nSTR - Lance Stroll TSU - Yuki Tsunoda VER - Max Verstappen\n```\n\n### Constructors\n```\nALP - Alpine AMR - Aston Martin FER - Ferrari HAS - Haas\nMCL - McLaren MER - Mercedes RB - Racing Bulls RBR - Red Bull Racing\nSAU - Sauber WIL - Williams\n```\n\n## \ud83d\udd0d Data Structure\n\n### Driver Data Structure\n```python\n{\n \"driverId\": \"maxverstappendriver\",\n \"name\": \"maxverstappendriver\", \n \"displayName\": \"maxverstappen\",\n \"abbreviation\": \"VER\",\n \"team\": \"Red Bull Racing\",\n \"position\": 3,\n \"value\": \"28.2M\",\n \"seasonTotalPoints\": 335,\n \"percentagePicked\": 16,\n \"isInactive\": false,\n \"races\": [\n {\n \"round\": \"14\",\n \"raceName\": \"Hungary\",\n \"totalPoints\": 11,\n \"race\": {\n \"dotd\": 0,\n \"position\": 10,\n \"qualifyingPosition\": 0,\n \"fastestLap\": 0,\n \"overtakeBonus\": 7,\n \"positionsGained\": 0,\n \"positionsLost\": -1,\n \"disqualificationPenalty\": 0\n },\n \"qualifying\": {\n \"position\": 3,\n \"disqualificationPenalty\": 0\n }\n }\n ],\n \"extractedAt\": \"2025-08-10T20:17:09.831Z\"\n}\n```\n\n## \ud83c\udfaf Usage Examples\n\n### Fantasy Team Analysis\n```python\nfrom formula_fantasy import *\n\n# Analyze your fantasy team performance\nmy_team = {\n \"drivers\": [\"NOR\", \"PIA\", \"VER\", \"RUS\", \"HAM\"],\n \"constructors\": [\"MCL\", \"RBR\"]\n}\n\nprint(\"=== My Fantasy Team Performance ===\")\ntotal_points = 0\n\nfor driver in my_team[\"drivers\"]:\n points = get_driver_points(driver, \"14\")\n info = get_driver_info(driver)\n total_points += points\n print(f\"{driver}: {points} pts (${info['value']}, {info['percentagePicked']}% picked)\")\n\nfor constructor in my_team[\"constructors\"]:\n points = get_constructor_points(constructor, \"14\") \n info = get_constructor_info(constructor)\n total_points += points\n print(f\"{constructor}: {points} pts (${info['value']}, {info['percentagePicked']}% picked)\")\n\nprint(f\"Total team points: {total_points}\")\n```\n\n### Driver Performance Analysis\n```python\n# Compare drivers over multiple rounds\ndrivers = [\"VER\", \"NOR\", \"HAM\", \"RUS\"]\nrounds = [\"12\", \"13\", \"14\"]\n\nprint(\"Driver Performance Comparison:\")\nprint(\"Driver\\\\tRound 12\\\\tRound 13\\\\tRound 14\\\\tAvg\")\n\nfor driver in drivers:\n points = []\n for round_num in rounds:\n pts = get_driver_points(driver, round_num)\n points.append(pts)\n \n avg = sum(points) / len(points)\n print(f\"{driver}\\\\t{points[0]}\\\\t{points[1]}\\\\t{points[2]}\\\\t{avg:.1f}\")\n```\n\n### Overtaking Kings Analysis\n```python\n# Find the best overtakers\ndrivers = list_drivers()\nround_num = \"14\"\n\nprint(f\"Top Overtakers - Round {round_num}:\")\novertake_data = []\n\nfor driver in drivers:\n try:\n overtakes = get_driver_breakdown(driver, round_num, \"race\", \"overtakeBonus\")\n if overtakes > 0:\n info = get_driver_info(driver)\n overtake_data.append((driver, info['team'], overtakes))\n except:\n continue\n\n# Sort by overtake points\novertake_data.sort(key=lambda x: x[2], reverse=True)\n\nfor i, (driver, team, points) in enumerate(overtake_data[:10], 1):\n print(f\"{i:2d}. {driver} ({team}): +{points} overtake points\")\n```\n\n## \ud83d\udd04 Data Updates\n\nThe library fetches data from GitHub in real-time, so you always get:\n- \u2705 Latest race results\n- \u2705 Most current driver/constructor standings \n- \u2705 Updated fantasy point calculations\n- \u2705 Recent team changes and driver swaps\n\nData is automatically updated after each race weekend.\n\n## \u26a0\ufe0f Error Handling\n\n```python\nfrom formula_fantasy import F1FantasyError\n\ntry:\n points = get_driver_points(\"INVALID\", \"14\")\nexcept F1FantasyError as e:\n print(f\"Error: {e}\")\n # Handle the error appropriately\n```\n\nCommon error scenarios:\n- Invalid driver/constructor abbreviation\n- Round data not available\n- Network connectivity issues\n- GitHub API rate limiting\n\n## \ud83d\udee0\ufe0f Advanced Usage\n\n### Custom Round Names\n```python\n# The library also supports race names (when available)\npoints = get_driver_points(\"VER\", \"Hungary\") # If supported\npoints = get_driver_points(\"VER\", \"14\") # Recommended approach\n```\n\n### Session-Specific Analysis\n```python\n# Compare qualifying vs race performance\ndriver = \"NOR\"\nround_num = \"14\"\n\nqualifying = get_driver_breakdown(driver, round_num, \"qualifying\")\nrace = get_driver_breakdown(driver, round_num, \"race\") \nsprint = get_driver_breakdown(driver, round_num, \"sprint\")\n\nprint(f\"{driver} Round {round_num}:\")\nprint(f\"Qualifying: {qualifying.get('position', 0)} pts\")\nprint(f\"Race: {race.get('position', 0)} pts\") \nprint(f\"Sprint: {sprint.get('position', 0)} pts\")\n```\n\n## \ud83c\udf1f Pro Tips\n\n1. **Use abbreviations consistently** - Always use 3-letter codes (VER, HAM, NOR)\n2. **Cache expensive calls** - Store driver/constructor info if calling repeatedly\n3. **Handle missing data gracefully** - Not all rounds have sprint sessions\n4. **Check latest round** - Use `get_latest_round()` to know what data is available\n5. **Batch CLI operations** - Use shell scripts for multiple queries\n\n## \ud83d\udcca Data Source\n\nThis library fetches data from the official F1 Fantasy scraper repository:\n- **GitHub Repository**: [JoshCBruce/fantasy-data](https://github.com/JoshCBruce/fantasy-data)\n- **Data Updates**: After each race weekend \n- **Coverage**: Complete 2025 F1 season\n- **Accuracy**: Official F1 Fantasy point calculations\n\n## \ud83e\udd1d Contributing\n\nFound a bug or want to contribute? \n1. Check the [issues page](https://github.com/yourusername/formula-fantasy/issues)\n2. Fork the repository\n3. Make your changes\n4. Submit a pull request\n\n## \ud83d\udcdc License\n\nMIT License - feel free to use in your own projects!\n\n---\n\n**Happy F1 Fantasy analysis! \ud83c\udfce\ufe0f\ud83d\udcca**\n",
"bugtrack_url": null,
"license": "MIT License\n \n Copyright (c) 2025 Josh Bruce\n \n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n ",
"summary": "A simple Python library for fetching F1 Fantasy driver and constructor data",
"version": "1.0.4",
"project_urls": {
"Data Source": "https://github.com/JoshCBruce/fantasy-data",
"Documentation": "https://github.com/yourusername/formula-fantasy#readme",
"Homepage": "https://github.com/yourusername/formula-fantasy",
"Issues": "https://github.com/yourusername/formula-fantasy/issues",
"Repository": "https://github.com/yourusername/formula-fantasy.git"
},
"split_keywords": [
"f1",
" formula1",
" fantasy",
" racing",
" motorsport",
" api",
" data",
" statistics"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "fec23c394628ff155c160f2ba93ab9be19cca30555b4c6d5181fa3af2fbb4e95",
"md5": "18c235ef165b9e14700fd3dd3e7efb91",
"sha256": "13d7833eb5841a21d04952ad4d95328e6cb5ab754a76f6a1acdf2967b8a53080"
},
"downloads": -1,
"filename": "formula_fantasy-1.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "18c235ef165b9e14700fd3dd3e7efb91",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 16510,
"upload_time": "2025-08-10T23:54:56",
"upload_time_iso_8601": "2025-08-10T23:54:56.193523Z",
"url": "https://files.pythonhosted.org/packages/fe/c2/3c394628ff155c160f2ba93ab9be19cca30555b4c6d5181fa3af2fbb4e95/formula_fantasy-1.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "60089a9acaa979ec1332c3bc85bbe69a45d06e9d390eb13a9a271c174536f9aa",
"md5": "9997c8f94d81b7562b32509a23dcfa87",
"sha256": "a7fa7e950671909d62c577171a7b37de0f067206421cfde223ef7f92c4c3ef90"
},
"downloads": -1,
"filename": "formula_fantasy-1.0.4.tar.gz",
"has_sig": false,
"md5_digest": "9997c8f94d81b7562b32509a23dcfa87",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 951217,
"upload_time": "2025-08-10T23:54:57",
"upload_time_iso_8601": "2025-08-10T23:54:57.384065Z",
"url": "https://files.pythonhosted.org/packages/60/08/9a9acaa979ec1332c3bc85bbe69a45d06e9d390eb13a9a271c174536f9aa/formula_fantasy-1.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-10 23:54:57",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "yourusername",
"github_project": "formula-fantasy",
"github_not_found": true,
"lcname": "formula-fantasy"
}