Skip to content

Commit

Permalink
Add more examples to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
xKynn committed Jan 2, 2018
1 parent 2cdd86c commit c313330
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions docs/index.rst
@@ -1,49 +1,58 @@
Welcome to PyBattlerite's documentation!
Welcome to PyVainglory's documentation!
===========================================

Basic Usage::

import pybattlerite
import pyvainglory
import requests

brc = pybattlerite.Client('your-api-key')
vgc = pyvainglory.Client('your-api-key')

# You can also provide an aiohttp.ClientSession to the BRClient constructor
# You can also provide a requests.Session to the Client constructor
session = requests.Session()
brc_a = pybattlerite.Client('your-api-key', session)
vgc_a = pyvainglory.Client('your-api-key', session)

# Get 3 matches after specified time
# after and before can also be datetime.datetime objects
matches = brc.get_matches(limit=3, after="2017-11-22T20:34:58Z")
matches = vgc.get_matches(limit=3, after="2017-11-22T20:34:58Z", region='na')

# Go to the next pages of matches
matches.next()

# Get telemetry data for one of the matches
telemetry = matches.matches[0].get_telemetry()

player = vgc.player_by_name('Demolasher36', region='sg')
my_blitz_games = player.games_played.blitz
my_recent_games = vgc.get_matches(limit=3, after="2018-01-1T20:34:58Z", playernames=['Demolasher36'], region='sg')

Async Usage::

import aiohttp
import asyncio
import pybattlerite
import pyvainglory

brc = pybattlerite.AsyncClient('your-api-key')
vgc = pyvainglory.AsyncClient('your-api-key')

# You can also provide an aiohttp.ClientSession to the BRClient constructor
# You can also provide an aiohttp.ClientSession to the AsyncClient constructor
session = aiohttp.ClientSession()
brc_a = pybattlerite.AsyncClient('your-api-key', session)
vgc_a = pyvainglory.AsyncClient('your-api-key', session)

# Get 3 matches after specified time
# after and before can also be datetime.datetime objects
matches = await brc.get_matches(limit=3, after="2017-11-22T20:34:58Z")
matches = await vgc.get_matches(limit=3, after="2017-11-22T20:34:58Z", region='na')

# Go to the next pages of matches
await matches.next()

# Get telemetry data for one of the matches
telemetry = await matches.matches[0].get_telemetry()

player = await vgc.player_by_name('Demolasher36', region='sg')
my_blitz_games = player.games_played.blitz
my_recent_games = await vgc.get_matches(limit=3, after="2018-01-1T20:34:58Z", playernames=['Demolasher36'], region='sg')

pyvainglory.Client
------------------------
Expand Down

0 comments on commit c313330

Please sign in to comment.