ShoobyDoo / OPGG.py

An unofficial Python library for accessing OPGG data.
BSD 3-Clause "New" or "Revised" License
13 stars 5 forks source link

Please include the identifier as well and try again. (#NA1, #EUW, etc.)") #11

Closed 201508876PMH closed 5 months ago

201508876PMH commented 5 months ago

I cant seem to search for any summoner. No matter how i try to define the Region. NA should be the default, but even that seems to complain with:

Exception: Multiple search results were returned

How can there me multiple results for a unique summoner name in NA?

ShoobyDoo commented 5 months ago

Hi,

I'm going to need a few things to get to the bottom of this issue. I had an issue recently with someone from EUW that had a non-standard identifier (#EUWX) and a relatively popular name, because of that, there were multiple summoners being returned that technically matched the username, but had different underlying account names. I'm guessing that's what is going on.

In any case, could you please provide me with the following:

  1. Python version
  2. OPGG.py version
  3. Summoner name you are trying to search AND the identifier
  4. A debug log (you can enable debug mode by doing the following:)
    
    # main.py
    from opgg import opgg
    from opgg.params import Region

def main():
opgg_obj = opgg.OPGG() opgg_obj.logger.setLevel("DEBUG") # <-- this will enable debug logging

# this is the typical syntax for when searching with an identifier
print(opgg_obj.search("Deadly Moon#EUWX", Region.EUW))

if name == "main": main()



Once you enable debugging, please attach the log that gets generated in the `logs` folder onto this issue

Thanks!
ShoobyDoo commented 5 months ago

This was indeed a bug, which I had caused during the previous 1.3.0 release 🤦 but has now been fixed.

Please install the latest version of OPGG.py and give it a try.

py -m pip install opgg.py==1.3.1
201508876PMH commented 5 months ago

Thanks for the quick feedback Shooby! I tried to install the specified version:

(venv) ➜  ~/OPGG.py git:(main) ✗ pip3 show opgg.py
Name: opgg.py
Version: 1.3.1
Summary: An unofficial Python library for scraping/accessing data from OP.GG
Home-page: https://github.com/ShoobyDoo/OPGG.py
Author: ShoobyDoo
Author-email:
License:
Location: /Users/$USER/venv/lib/python3.12/site-packages
Requires: beautifulsoup4, requests
Required-by:

But still seeing the same issue Exception: Multiple search results were returned for "Stefty#EUWX". Please include the identifier as well and try again. (#NA1, #EUW, etc.)

ps. i also tried #EUW, but still without success

Here is the generated log: opgg_2024-05-15.log

ShoobyDoo commented 5 months ago

I can't seem to reproduce, I created a completely fresh Python 3.12 virtual env installing the latest version, and used the following:

from opgg import opgg
from opgg.params import Region

def main():    
    opgg_obj = opgg.OPGG()
    opgg_obj.logger.setLevel("DEBUG")

    print(opgg_obj.search("Stefty#EUW", Region.EUW))

if __name__ == "__main__":
    main()

Which seems to return the following:

[Summoner: Stefty]
--------------------------------------------------------------------------------
Id                          (int) | 33091204
Summoner Id                 (str) | 3ki-WOsTh1hB-UBfvHUxgPp1sD5bBP4YOLNEhD9XV0GI3jc
Account Id                  (str) | k1NgnQp8jIex9pYBIAZBhjwQbQfH4tejH2OOpzjbBA8U5A
Puuid                       (str) | DpLDhMgenwpV0MpV-yPor3rDoeNk3JoyZZ6_Mj1ezDuMPg0Zvcxm07Vyf8GlWPVhLTgAI_KgFgVcPw
Game Name                   (str) | Stefty
Tagline                     (str) | EUW
Name                        (str) | Stefty
Internal Name               (str) | stefty
Profile Image Url           (str) | https://opgg-static.akamaized.net/meta/images/profile_icons/profileIcon6295.jpg
Level                       (int) | 529
Updated At             (datetime) | 2024-05-14T06:59:00+09:00
Renewable At           (datetime) | 2024-05-14T07:01:00+09:00
Previous Seasons         (Season) | [List (12)] 
                                  | Season(season=SeasonInfo(display_value=2024, is_preseason=0), tier_info=Tier(tier=EMERALD, division=2, lp=37))
                                  | Season(season=SeasonInfo(display_value=2023, is_preseason=0), tier_info=Tier(tier=EMERALD, division=4, lp=0))
                                  | Season(season=SeasonInfo(display_value=2023, is_preseason=0), tier_info=Tier(tier=PLATINUM, division=3, lp=0))
                                  | Season(season=SeasonInfo(display_value=2022, is_preseason=0), tier_info=Tier(tier=PLATINUM, division=4, lp=32))
                                  | Season(season=SeasonInfo(display_value=2021, is_preseason=0), tier_info=Tier(tier=PLATINUM, division=4, lp=0))
                                  | Season(season=SeasonInfo(display_value=2020, is_preseason=0), tier_info=Tier(tier=PLATINUM, division=3, lp=57))
                                  | Season(season=SeasonInfo(display_value=9, is_preseason=0), tier_info=Tier(tier=PLATINUM, division=4, lp=53))
                                  | Season(season=SeasonInfo(display_value=8, is_preseason=0), tier_info=Tier(tier=PLATINUM, division=5, lp=14))
                                  | Season(season=SeasonInfo(display_value=7, is_preseason=0), tier_info=Tier(tier=GOLD, division=5, lp=45))
                                  | Season(season=SeasonInfo(display_value=6, is_preseason=0), tier_info=Tier(tier=GOLD, division=5, lp=19))
                                  | Season(season=SeasonInfo(display_value=5, is_preseason=0), tier_info=Tier(tier=SILVER, division=2, lp=98))
                                  | Season(season=SeasonInfo(display_value=4, is_preseason=0), tier_info=Tier(tier=SILVER, division=4, lp=0))
League Stats        (LeagueStats) | [List (3)]
                                  | LeagueStats(queue_info=QueueInfo(game_type=SOLORANKED), tier_info=Tier(tier=UNRANKED, division=0, lp=0), win=0 / lose=0 (winrate: 0%))
                                  | LeagueStats(queue_info=QueueInfo(game_type=FLEXRANKED), tier_info=Tier(tier=UNRANKED, division=0, lp=0), win=0 / lose=0 (winrate: 0%))
                                  | LeagueStats(queue_info=QueueInfo(game_type=ARENA), tier_info=Tier(tier=UNRANKED, division=0, lp=0), win=0 / lose=0 (winrate: 0%))
Most Champions       (ChampStats) | [List (0)]
Recent Game Stats          (Game) | [List (0)]

Can you confirm whether or not that's your summoner? If so, try creating a fresh virtual env, installing the latest version and trying the template above.

If you're still having issues after all that, please reach out to me on the support discord here: https://discord.com/invite/fzRK2Sb and we can try debugging further.

201508876PMH commented 5 months ago

Odd. Must have been some bad cache in my py env. It's working now! Amazing...thanks Shooby!

ShoobyDoo commented 5 months ago

Sounds good, glad to hear it!