Skip to content
This repository was archived by the owner on Jan 18, 2026. It is now read-only.

Quickstart

dxstiny edited this page Jul 1, 2022 · 4 revisions

Get all available information one by one

import asyncio

from cevlib.match import Match, MatchCache

async def main():
    # get a match object by its match centre url
    match: Match = await Match.byUrl("https://championsleague.cev.eu/en/match-centres/cev-champions-league-volley-2022/men/clm-61-cucine-lube-civitanova-v-ok-merkur-maribor/")

    # print all available properties

    print(await match.playByPlay())
    print(await match.competition())
    print(await match.topPlayers())
    print(await match.report())
    print(await match.info())
    print(match.gallery) # Disclaimer: Photos featured on the CEV Photo Galleries are downloadable copyright free for media purposes only and only if CEV is credited as the source material. They are protected by copyright for all other commercial purposes. Those wishing to use CEV Photo Gallery photos for other commercial purposes should contact press@cev.eu
    print(match.matchCentreLink)

    await match.init()

    print(await match.result())
    print(await match.duration())
    print(await match.startTime())
    print(await match.venue())
    print(await match.homeTeam())
    print(await match.watchLink())
    print(await match.highlightsLink())
    print(await match.state())

asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
asyncio.run(main())

In this example, every information is fetched directly from cev.eu, not from a cache. While this always retrieves the newest information, running calling all functions sequentially takes quite some time.

Get multiple information simultaneously

Since the requests are asynchronously, you can call multiple functions simultaneously and "gather" the promises:

duration, venue = await asyncio.gather(match.duration(), match.venue())

Get all available information simultaneously

Alternatively, cevlib can handle simultaneous calls to each available function:

match = await Match.byUrl("https://www.cev.eu/match-centres/2022-european-cups/cev-volleyball-challenge-cup-2022-men/chcm-61-halkbank-ankara-v-tallinn-technical-university/")

cache: MatchCache = await match.cache()
# OR
cache: MatchCache = await MatchCache.fromMatch(match)

You can then retrieve all the information almost immediately:

print("playByPlay", cache.playByPlay)
print("competition", cache.competition)
print("topPlayers", cache.topPlayers)
print("report", cache.report)
print("gallery", cache.gallery) # Disclaimer: Photos featured on the CEV Photo Galleries are downloadable copyright free for media purposes only and only if CEV is credited as the source material. They are protected by copyright for all other commercial purposes. Those wishing to use CEV Photo Gallery photos for other commercial purposes should contact press@cev.eu
print("matchCentreLink", cache.matchCentreLink)
print("result (current score)", cache.result)
print("duration", cache.duration)
print("startTime", cache.startTime)
print("venue", cache.venue)
print("homeTeam", cache.homeTeam)
print("watchLink", cache.watchLink)
print("highlightsLink", cache.highlightsLink)
print("state", cache.state)

NOTE: Creating a cache and retrieving the information from this cache is significantly faster than executing the requests sequentially, but the data is not retrieved directly from cev.eu and is therefore not always up-to-date.

Clone this wiki locally