Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs and README #244

Merged
merged 2 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,17 @@ raised as HTTPError exceptions from the Requests library.

.. code:: python

from riotwatcher import LolWatcher, ApiError
from riotwatcher import LolWatcher, RiotWatcher, ApiError

lol_watcher = LolWatcher('<your-api-key>')

riot_watcher = RiotWatcher('<your-api-key>')

my_region = 'na1'

me = lol_watcher.summoner.by_name(my_region, 'pseudonym117')
my_account = riot_watcher.account.by_riot_id('AMERICAS', 'pseudonym', 'sudo')

me = lol_watcher.summoner.by_puuid(my_region, my_account['puuid'])
print(me)

# all objects are returned (by default) as a dict
Expand Down
10 changes: 7 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,17 @@ raised as HTTPError exceptions from the Requests library.

.. code:: python

from riotwatcher import LolWatcher, ApiError
from riotwatcher import LolWatcher, RiotWatcher, ApiError

lol_watcher = LolWatcher('<your-api-key>')

riot_watcher = RiotWatcher('<your-api-key>')

my_region = 'na1'

me = lol_watcher.summoner.by_name(my_region, 'pseudonym117')
my_account = riot_watcher.account.by_riot_id('AMERICAS', 'pseudonym', 'sudo')

me = lol_watcher.summoner.by_puuid(my_region, my_account['puuid'])
print(me)

# all objects are returned (by default) as a dict
Expand All @@ -72,7 +76,7 @@ raised as HTTPError exceptions from the Requests library.
response = lol_watcher.summoner.by_name(my_region, 'this_is_probably_not_anyones_summoner_name')
except ApiError as err:
if err.response.status_code == 429:
print('We should retry in {} seconds.'.format(err.headers['Retry-After']))
print('We should retry in {} seconds.'.format(err.response.headers['Retry-After']))
print('this retry-after is handled by default by the RiotWatcher library')
print('future requests wait until the retry-after time passes')
elif err.response.status_code == 404:
Expand Down
Loading