Skip to content

Commit

Permalink
Update docs and README (#244)
Browse files Browse the repository at this point in the history
* Update README.rst

* Update docs index.rst
  • Loading branch information
BlossomiShymae authored May 17, 2024
1 parent 562d2d4 commit c71841f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
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

0 comments on commit c71841f

Please sign in to comment.