frissyn / valorant.py

Complete Python interface for the Valorant API. Works right out of the box!
https://valorantpy.readthedocs.io
MIT License
125 stars 19 forks source link

Matchlist not retrievable #40

Closed gwynethyuen closed 2 years ago

gwynethyuen commented 2 years ago

I am getting a 403 Client Error when I try to get the match list of a specific user. I did see the closed issue (#36), however, all the other information is retrievable, but it's just the match list that throws the error. I can search the skins, print out the other attributes with an AccountDTO (gameName, puuid, tagLine), just the match list fails.

Code:

import valorant

KEY = "my key"
client = valorant.Client(KEY, locale=None)

# print the skin collection typed in by user
skins = client.get_skins()
name = input("Search a Valorant Skin Collection: ")
results = skins.find_all(name=lambda x: name.lower() in x.lower())
print("\nResults: ")
for skin in results:
    print(f"\t{skin.name.ljust(21)} ({skin.localizedNames['ja-JP']})")

# get viper object
agents = client.get_characters()
print(agents.get("Viper"))
print()

# try to get account matchlist
acc = client.get_user_by_name(name="BabyJ#Halo", route='americas')
print("ACCOUNT ATTRIBUTES")
print(acc.gameName, acc.puuid, acc.tagLine)
print()
matches = acc.matchlist()

Output:

Search a Valorant Skin Collection: prime

Results: 
        Prime//2.0 Odin       (プライム//2.0 オーディン)
        Prime Vandal          (プライム ヴァンダル)
        Prime//2.0 Phantom    (プライム//2.0 ファントム)
        Prime//2.0 Bucky      (プライム//2.0 バッキー)
        Prime//2.0 Frenzy     (プライム//2.0 フレンジー)
        Prime Classic         (プライム クラシック)
        Prime Guardian        (プライム ガーディアン)
        Prime Spectre         (プライム スペクター)
        Prime Axe             (プライム アックス)
        Prime//2.0 Karambit   (プライム//2.0 カラムビット)
<class ContentItemDTO @assetName=Default__Pandemic_PrimaryAsset_C @id=707EAB51-4836-F488-046A-CDA6BF494859 @localizedNames={'ar-AE': 'فايبر', 'de-DE': 'Viper', 'en-US': 'Viper', 'es-ES': 'Viper', 'es-MX': 'Viper', 'fr-FR': 'Viper', 'id-ID': 'Viper', 'it-IT': 'Viper', 'ja-JP': 'ヴァイパー', 'ko-KR': '바이퍼', 'pl-PL': 'Viper', 'pt-BR': 'Viper', 'ru-RU': 'Viper', 'th-TH': 'Viper', 'tr-TR': 'VIPER', 'vi-VN': 'Viper', 'zh-CN': '蝰蛇', 'zh-TW': '薇蝮'} @name=Viper>

ACCOUNT ATTRIBUTES
BabyJ uvPbmdPpXztUUnRD8XpUqEXXJnqgXCiTUkFFBoNBMxIS-iowse7VtRLCSOm2hua7bwn7-X_9zi0xmQ Halo

Traceback (most recent call last):
  File "/Users/gyuen/Documents/GitHub/val-discord-tracker/bot.py", line 26, in <module>
    matches = acc.matchlist()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/valorant/objects/account.py", line 22, in matchlist
    l = self.handle.call("GET", "matchlists", puuid=self.puuid)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/valorant/caller.py", line 57, in call
    r.raise_for_status()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/requests/models.py", line 1022, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://na.api.riotgames.com/val/match/v1/matchlists/by-puuid/uvPbmdPpXztUUnRD8XpUqEXXJnqgXCiTUkFFBoNBMxIS-iowse7VtRLCSOm2hua7bwn7-X_9zi0xmQ
frissyn commented 2 years ago

Thanks for reporting @gwynethyuen, I'll take a look by tomorrow, I'm currently busy right now. Sorry

Quanta-of-solitude commented 2 years ago

Does the development key no longer give matchlist access?

frissyn commented 2 years ago

Does the development key no longer give matchlist access?

The development key never gave matchlist access

frissyn commented 2 years ago

image

image

@gwynethyuen You are getting a 403 because a player's match history is unavailable without an approved API key/app.