Skip to main content

A python package to interact with the Soccer Fantasy Game Biwenger

Project description

pybiwenger

pybiwenger logo

pybiwenger is a Python library for interacting with the Biwenger Soccer Fantasy Game API. It provides convenient access to your account, league, market, and player data, enabling automation and analysis for Biwenger users.


Features

  • Authentication: Secure login using your Biwenger credentials.
  • Account Management: Access your user, team, and league information.
  • Players API: Retrieve player data, rosters, and historical stats.
  • Market API: Get current market data for players.
  • League API: Fetch league users and standings.

Installation

Clone the repository:

git clone https://github.com/pablominue/pybiwenger.git
cd pybiwenger
pip install .

Or install via pip:

pip install pybiwenger

Authentication

Before using any API, authenticate with your Biwenger credentials:

import pybiwenger

pybiwenger.authenticate(
    username="your_biwenger_email",
    password="your_biwenger_password"
)

Your credentials are stored securely in your local environment variables.


Quickstart Example

from pybiwenger.src.client import BiwengerBaseClient
from pybiwenger.src.biwenger.players import PlayersAPI
from pybiwenger.src.biwenger.market import MarketAPI
from pybiwenger.src.biwenger.league import LeagueAPI

# Authenticate first (see above)

# Access account info
client = BiwengerBaseClient()
print("Your team:", client.user_team)

# Get all players in the league
players_api = PlayersAPI()
all_players = players_api.get_all_players()
print("Total players:", len(all_players))

# Get your roster
my_team = players_api.get_user_roster(client.user.id)
print("My roster:", my_team.players)

# Get market data
market_api = MarketAPI()
market = market_api.get_market_data()
print("Market players:", market)

# Get league users and standings
league_api = LeagueAPI()
users = league_api.get_users()
standings = league_api.get_classification()
print("League standings:")
for standing in standings:
    print(f"{standing.position}. {standing.name} - {standing.points} pts")

API Reference

pybiwenger.src.client.BiwengerBaseClient

  • Handles authentication, session management, and basic API requests.
  • Properties:
    • user_league: Your league info.
    • user: Your user info.
    • user_team: Your team (owner + players).
  • Methods:
    • fetch(url: str): Fetch data from Biwenger API.

pybiwenger.src.biwenger.players.PlayersAPI

  • Inherits from BiwengerBaseClient.
  • Methods:
    • get_all_players(): Returns all players in the competition.
    • get_league_users(): Returns all users in your league.
    • get_user_roster(owner_id: int): Returns a user's team.
    • get_rosters_by_owner(): Returns all teams in the league.
    • get_player_history(player, ...): Returns historical points and price for a player.

pybiwenger.src.biwenger.market.MarketAPI

  • Inherits from BiwengerBaseClient.
  • Methods:
    • get_market_data(): Returns current market data for players.

pybiwenger.src.biwenger.league.LeagueAPI

  • Inherits from BiwengerBaseClient.
  • Methods:
    • get_users(): Returns all users in the league.
    • get_classification(): Returns current league standings.

Contributing

Pull requests and issues are welcome! Please open an issue for bugs or feature requests.


License

MIT License. See LICENSE for details.


Disclaimer

This library is not affiliated with Biwenger or its parent companies. Use at your own risk and respect Biwenger's terms of

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pybiwenger-1.3.0.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pybiwenger-1.3.0-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file pybiwenger-1.3.0.tar.gz.

File metadata

  • Download URL: pybiwenger-1.3.0.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.3 Linux/6.6.87.1-microsoft-standard-WSL2

File hashes

Hashes for pybiwenger-1.3.0.tar.gz
Algorithm Hash digest
SHA256 2af121c00057edff45a6d46ff8159f9511a2ee0b260679104ab28cb032dd9f0c
MD5 f06334b080d466463cdc0622365fe141
BLAKE2b-256 533c009a2d53de1739b44968dbcf33797bc64a8cac9f83eb108a8e8b8e85a2c2

See more details on using hashes here.

File details

Details for the file pybiwenger-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: pybiwenger-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 19.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.3 Linux/6.6.87.1-microsoft-standard-WSL2

File hashes

Hashes for pybiwenger-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9fe3caec1ab144634ee5a2a29bff835ef7e8337061e2604301cfdb42305c0536
MD5 273581d35abb639498a1ab9f9932c0bf
BLAKE2b-256 aaf5e8fbfe9d9ad0de4a14055dcd41f29799f28856ebf97f7872fa5c7de846b5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page