Skip to main content

API client for SofaScore soccer data

Project description

🇷🇺 Русский | 🇬🇧 English

PyPI Version PyPI Downloads LICENSE

Aiosofascore

Aiosofascore — асинхронный Python-клиент для SofaScore API (футбол), предоставляющий удобный доступ к данным о командах, матчах, поиску и статистике.

Возможности

  • Получение информации о командах, последних матчах, статистике
  • Поиск игроков, команд, событий, менеджеров
  • Асинхронный HTTP-клиент на базе aiohttp
  • Удобный фасад SofaScoreClient для всех сервисов

Установка

pip install aiosofascore

Быстрый старт

Получить последние события команды

import asyncio
from aiosofascore.client import SofaScoreClient

async def main():
    client = SofaScoreClient(base_url="http://api.sofascore.com/api")
    team_id = 25856
    result = await client.team.last_events.get_last_events(team_id)
    for event in result.events:
        tournament_name = event.tournament.name if event.tournament and event.tournament.name else "-"
        print(f"Event id: {event.id}, турнир: {tournament_name}, дата: {event.startTimestamp}")

if __name__ == "__main__":
    asyncio.run(main())

Пример поиска

import asyncio
from aiosofascore.client import SofaScoreClient

async def main():
    client = SofaScoreClient(base_url="http://api.sofascore.com/api")
    # Поиск менеджеров по имени Alexander
    async for result in client.search.search.search_entities("Alexander", type="manager"):
        name = result.entity.name if result.entity and hasattr(result.entity, 'name') else "-"
        team = result.entity.team.name if result.entity and hasattr(result.entity, 'team') and result.entity.team and hasattr(result.entity.team, 'name') else "-"
        print(f"Имя: {name}, Тип: {result.type}, Команда: {team}")

if __name__ == "__main__":
    asyncio.run(main())

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

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

aiosofascore-0.1.0.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

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

aiosofascore-0.1.0.0-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file aiosofascore-0.1.0.0.tar.gz.

File metadata

  • Download URL: aiosofascore-0.1.0.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for aiosofascore-0.1.0.0.tar.gz
Algorithm Hash digest
SHA256 9e93457bde2222731a331209c50071d6e05be1d9d719e18e13cc16ff68cc3fcc
MD5 fed8819f5310341a0c9d0717dadba75f
BLAKE2b-256 5782c11eb7e78648b8e17a1380073f67efbd8f6aee91eb8c356fd053fa784dc4

See more details on using hashes here.

File details

Details for the file aiosofascore-0.1.0.0-py3-none-any.whl.

File metadata

  • Download URL: aiosofascore-0.1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for aiosofascore-0.1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a401d3c3f1e68148a8de9591a2fc00a7bdadee0f0baeb32a3fca2a91107e340b
MD5 cbd5e38eba2cc2a71015b6ac117c425a
BLAKE2b-256 1e7fea47e96852aae17a70ec2b1bfca75d5d7d324e9f717fc2855fdbbdfd63d7

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