Aiosofascore
Aiosofascore — асинхронный Python-клиент для SofaScore API (футбол), предоставляющий удобный доступ к данным о командах, матчах, поиску и статистике.
Возможности
- Получение информации о командах, последних матчах, статистике
- Поиск игроков, команд, событий, менеджеров
- Асинхронный HTTP-клиент на базе aiohttp
Установка
pip install aiosofascore
Пример работы с командой (все основные возможности)
import asyncio
from aiosofascore.client import SofaScoreClient
TEAM_ID = 2819 # Можно заменить на нужный ID
PAGE = 0
async def main():
async with SofaScoreClient() as client:
# Игроки
players = await client.team.players.get_team_players(TEAM_ID)
print(f"\n=== Игроки команды ===")
if players.players:
for i, player_item in enumerate(players.players, 1):
player = player_item.player
print(f"{i:2d}. {player.name} | {player.position or '-'} | №{player.jerseyNumber or '-'}")
# Последние события
last_events = await client.team.last_events.get_last_events(TEAM_ID, PAGE)
print(f"\n=== Последние события ===")
for event in last_events.events:
tournament_name = event.tournament.name if event.tournament and event.tournament.name else "-"
print(f"Event id: {event.id}, турнир: {tournament_name}, дата: {event.startTimestamp}")
# Производительность
perf = await client.team.performance.get_team_performance(TEAM_ID)
print(f"\n=== Производительность ===")
if perf.events:
for i, event in enumerate(perf.events[:5], 1):
home = event.homeTeam.name if event.homeTeam else '-'
away = event.awayTeam.name if event.awayTeam else '-'
print(f"{i:2d}. {home} vs {away}")
if event.homeScore and event.awayScore:
print(f" Счёт: {event.homeScore.current or 0} - {event.awayScore.current or 0}")
# Рейтинги
rankings = await client.team.rankings.get_team_rankings(TEAM_ID)
print(f"\n=== Рейтинги ===")
if rankings.rankings:
for r in rankings.rankings:
print(f"{r.rowName or '-'}: {r.ranking} место, {r.points} очков, турнир: {r.currentTournamentName}")
# Трансферы
transfers = await client.team.transfers.get_team_transfers(TEAM_ID)
print(f"\n=== Входящие трансферы ===")
if transfers.transfersIn:
for t in transfers.transfersIn:
print(f"{t.player.name if t.player else '-'} из {t.fromTeamName or '-'} за {t.transferFeeDescription or '-'}")
print(f"\n=== Исходящие трансферы ===")
if transfers.transfersOut:
for t in transfers.transfersOut:
print(f"{t.player.name if t.player else '-'} в {t.toTeamName or '-'} за {t.transferFeeDescription or '-'}")
if __name__ == "__main__":
asyncio.run(main())
Настройка HTTP-сессии
При ошибках 403 (anti-bot challenge) передайте cookies из браузера:
async with SofaScoreClient(cookies={"your_cookie": "value"}) as client:
...
Или через переменную окружения SOFASCORE_COOKIES (JSON). Опционально: SOFASCORE_PROXY для прокси.
License
This project is licensed under the MIT License — see the LICENSE file for details.
Contact
If you have any questions or suggestions, feel free to open an issue or contact me via vasilewskij.fil@gmail.com
Metadata
Release files for aiosofascore 0.1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aiosofascore-0.1.2.0.tar.gz | 14.4 kB | Without provenance | Details for aiosofascore-0.1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aiosofascore-0.1.2.0-py3-none-any.whl | Python 3 | none | any | Details for aiosofascore-0.1.2.0-py3-none-any.whl |
Total release size: 29.8 kB
Release files / aiosofascore-0.1.2.0.tar.gz
| Download URL | aiosofascore-0.1.2.0.tar.gz |
|---|---|
| Size | 14.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7b7fd1cd5c7edf74cc33a5ff6c1d7f18c9eedf81c255092e43ca9a327d106214
|
|
BLAKE2b-256 checksum How to use checksums |
81dda887cf169dc4eea47e92543826418b7d92e322ae27dc8ae91d72f405a06c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / aiosofascore-0.1.2.0-py3-none-any.whl
| Download URL | aiosofascore-0.1.2.0-py3-none-any.whl |
|---|---|
| Size | 15.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c133ce1c05ec8fde2648e81e20b2a2daf38fc34f37afb4082753f25b481aa602
|
|
BLAKE2b-256 checksum How to use checksums |
f0f18f844b35fbb98aabc5492f3171d7a925d6bf54d4d798f3419b77bf2093df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Security for aiosofascore 0.1.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.