Skip to content

Commit

Permalink
Removed match_v4; bumped version (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
pseudonym117 authored Oct 14, 2021
1 parent 3a1e147 commit 368cd2c
Show file tree
Hide file tree
Showing 14 changed files with 58 additions and 479 deletions.
56 changes: 22 additions & 34 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Check for full (read: slightly better) documentation `here <http://riot-watcher.

RiotWatcher is a thin wrapper on top of the `Riot Games API for League
of Legends <https://developer.riotgames.com/>`__. All public methods as
of 8/11/2021 are supported in full.
of 10/14/2021 are supported in full.

RiotWatcher by default supports a naive rate limiter. This rate limiter will
try to stop you from making too many requests, and in a single threaded test
Expand Down Expand Up @@ -84,47 +84,25 @@ raised as HTTPError exceptions from the Requests library.
else:
raise
MatchApiV5
----------

As of 8/11/2021, both the v4 and v5 versions of the Match API are supported by Riot. As such, RiotWatcher provides a
method to use both. By default, the v4 API will be used for backwards compatibility.

To use the v5 API by default, use the following to initialize your LolWatcher instance:

.. code:: python
from riotwatcher import LolWatcher
lol_watcher = LolWatcher('<your-api-key>', default_default_match_v5=True)
# example call
matchlist = lol_watcher.match.matchlist_by_puuid('AMERICAS', 'fake-puuid')
To explicitly use v4 or v5 during the deprecation period, you can use the following properties:


.. code:: python
from riotwatcher import LolWatcher
lol_watcher = LolWatcher('<your-api-key>')
# use v5 explicitly
matchlist = lol_watcher.match_v5.matchlist_by_puuid('AMERICAS', 'fake-puuid')
DataDragon
----------

# use v4 explicitly
old_matchlist = lol_watcher.match_v4.matchlist_by_account('na1', 'fake-account-id')
Keep in mind when using data dragon APIs with LolWatcher that regions are NOT the same as the other API regions.
Specifically, the following regions are renamed (as of writing):

Note: this will not be supported after v4 is completely deprecated! Both match_v4 and match_v5 properties will be removed,
and the change will happen with a minor version increase. If you desire seamless backwards compatibility, do not use these
properies.
======== ===========
**API** **ddragon**
-------- -----------
eun1 eune
oc1 oce
======== ===========


StatusApiV4
-----------

As of 8/11/2021 (and from the looks of it, indefinitely), both v3 and v4 versions of the LolStatus API are supported by Riot.
As of 10/14/2021 (and from the looks of it, indefinitely), both v3 and v4 versions of the LolStatus API are supported by Riot.
As such, RiotWatcher provides a method to use both. By default, the v3 API will be used for backwards compatibility.

To use the v4 API by default, use the following to initialize your LolWatcher instance:
Expand Down Expand Up @@ -187,6 +165,16 @@ Rate limiter has some race conditions when used concurrently.

Changelog
---------
v3.2.0 - 10/14/2021
~~~~~~~~~~~~~~~~~~~
Removed match_v4 and match_v5 properties from LolWatcher. Use match property now - will use v5 API.

Use persistent http session to connect to API.

Added startTime and endTime params for match v5 api

Documented ddragon weirdness

v3.1.4 - 8/11/2021
~~~~~~~~~~~~~~~~~~
Add LolStatus-V4 API. Didnt realize this existed until now.
Expand Down
42 changes: 10 additions & 32 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,41 +80,19 @@ raised as HTTPError exceptions from the Requests library.
else:
raise
MatchApiV5
----------

As of 7/4/2021, both the v4 and v5 versions of the Match API are supported by Riot. As such, RiotWatcher provides a
method to use both. By default, the v4 API will be used for backwards compatibility.

To use the v5 API by default, use the following to initialize your LolWatcher instance:

.. code:: python
from riotwatcher import LolWatcher
lol_watcher = LolWatcher('<your-api-key>', default_default_match_v5=True)
# example call
matchlist = lol_watcher.match.matchlist_by_puuid('AMERICAS', 'fake-puuid')
To explicitly use v4 or v5 during the deprecation period, you can use the following properties:

.. code:: python
from riotwatcher import LolWatcher
lol_watcher = LolWatcher('<your-api-key>')
# use v5 explicitly
matchlist = lol_watcher.match_v5.matchlist_by_puuid('AMERICAS', 'fake-puuid')
# use v4 explicitly
old_matchlist = lol_watcher.match_v4.matchlist_by_account('na1', 'fake-account-id')
DataDragon
----------

Note: this will not be supported after v4 is completely deprecated! Both match_v4 and match_v5 properties will be removed,
and the change will happen with a minor version increase. If you desire seamless backwards compatibility, do not use these
properies.
Keep in mind when using data dragon APIs with LolWatcher that regions are NOT the same as the other API regions.
Specifically, the following regions are renamed (as of writing):

======== ===========
**API** **ddragon**
-------- -----------
eun1 eune
oc1 oce
======== ===========

Use with kernel
---------------
Expand Down
8 changes: 0 additions & 8 deletions docs/riotwatcher/LeagueOfLegends/MatchApiV4.rst

This file was deleted.

2 changes: 0 additions & 2 deletions docs/riotwatcher/LeagueOfLegends/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ All APIs
LeagueApiV4.rst
LolStatusApiV3.rst
LolStatusApiV4.rst
MatchApiV4.rst
MatchApiV5.rst
SpectatorApiV4.rst
SummonerApiV4.rst
ThirdPartyCodeApiV4.rst

44 changes: 22 additions & 22 deletions src/riotwatcher/LolWatcher.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import logging
from typing import Union

from .Deserializer import Deserializer
from .RateLimiter import RateLimiter

Expand All @@ -22,13 +24,14 @@
LeagueApiV4,
LolStatusApiV3,
LolStatusApiV4,
MatchApiV4,
SpectatorApiV4,
SummonerApiV4,
MatchApiV5,
ThirdPartyCodeApiV4,
)

log = logging.getLogger(__name__)


class LolWatcher:
"""
Expand All @@ -42,8 +45,8 @@ def __init__(
kernel_url: str = None,
rate_limiter: RateLimiter = BasicRateLimiter(),
deserializer: Deserializer = DictionaryDeserializer(),
default_match_v5: bool = False,
default_status_v4: bool = False,
**kwargs,
):
"""
Initialize a new instance of the RiotWatcher class.
Expand Down Expand Up @@ -93,19 +96,22 @@ def __init__(
self._clash = ClashApiV1(self._base_api)
self._champion_mastery = ChampionMasteryApiV4(self._base_api)
self._league = LeagueApiV4(self._base_api)
self._match_v4 = MatchApiV4(self._base_api)
self._match_v5 = MatchApiV5(self._base_api)
self._match = MatchApiV5(self._base_api)
self._spectator = SpectatorApiV4(self._base_api)
self._summoner = SummonerApiV4(self._base_api)
self._third_party_code = ThirdPartyCodeApiV4(self._base_api)

self._match = self._match_v5 if default_match_v5 else self._match_v4
self._lol_status = (
self._lol_status_v4 if default_status_v4 else self._lol_status_v3
)
# todo: tournament-stub
# todo: tournament

if "default_match_v5" in kwargs:
log.warn(
"property 'default_match_v5' has been deprecated and can be removed"
)

@property
def champion_mastery(self) -> ChampionMasteryApiV4:
"""
Expand Down Expand Up @@ -170,7 +176,7 @@ def lol_status_v4(self) -> LolStatusApiV4:
return self._lol_status_v4

@property
def match(self) -> Union[MatchApiV4, MatchApiV5]:
def match(self) -> MatchApiV5:
"""
Interface to the Match Endpoint
Expand All @@ -179,24 +185,18 @@ def match(self) -> Union[MatchApiV4, MatchApiV5]:
return self._match

@property
def match_v4(self) -> MatchApiV4:
"""
Temporary explicit interface to match-v4 endpoint.
Will be removed when matchv4 is deprecated.
:rtype: league_of_legends.MatchApiV4
"""
return self._match
def match_v4(self):
"""this property has been deprecated. Use 'match' property instead. Note that v4 is now permanently removed by Riot"""
raise NotImplementedError(
"this property has been deprecated. Use 'match' property instead. Note that v4 is now permanently removed by Riot"
)

@property
def match_v5(self) -> MatchApiV5:
"""
Temporary explicit interface to match-v5 endpoint.
Will be removed when matchv4 is deprecated.
:rtype: league_of_legends.MatchApiV5
"""
return self._match_v5
def match_v5(self):
"""this property has been deprecated. Use 'match' property instead."""
raise NotImplementedError(
"this property has been deprecated. Use 'match' property instead."
)

@property
def spectator(self) -> SpectatorApiV4:
Expand Down
2 changes: 1 addition & 1 deletion src/riotwatcher/__version__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = "3.1.4"
__version__ = "3.2.0"
__author__ = "pseudonym117"
__title__ = "RiotWatcher"
110 changes: 0 additions & 110 deletions src/riotwatcher/_apis/league_of_legends/MatchApiV4.py

This file was deleted.

1 change: 0 additions & 1 deletion src/riotwatcher/_apis/league_of_legends/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from .LeagueApiV4 import LeagueApiV4
from .LolStatusApiV3 import LolStatusApiV3
from .LolStatusApiV4 import LolStatusApiV4
from .MatchApiV4 import MatchApiV4
from .SpectatorApiV4 import SpectatorApiV4
from .SummonerApiV4 import SummonerApiV4
from .ThirdPartyCodeApiV4 import ThirdPartyCodeApiV4
Expand Down
Loading

0 comments on commit 368cd2c

Please sign in to comment.