GithubHelp home page GithubHelp logo

iann838 / pyot Goto Github PK

View Code? Open in Web Editor NEW
101.0 4.0 15.0 942 KB

AsyncIO-based high-level Python framework for the Riot Games API. (DEPRECATED, please use pulsefire instead)

Home Page: https://paaksing.github.io/Pyot/

License: MIT License

Python 100.00%
pyot asyncio league-of-legends teamfight-tactics valorant legends-of-runeterra riot-games-api

pyot's Issues

SummonerLeague does not have attribute entries.

I am using the SummonerLeague object and trying to get to its entries. I get an error which says that the object does not have an attribute named entries. According to the source code and the documentation however, it does.

Code:

summoner = await lol.Summoner(name=name, platform=region).get()
leagues = summoner.league_entries
print(leagues.entries)

Output:

'SummonerLeague' object has no attribute 'entries'
'SummonerLeague' object has no attribute 'entries'

Code:

print(dir(leagues))
print(vars(leagues))

Output:

['Meta', '__annotations__', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattr__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_locale', '_meta', '_platform', '_platform2regions', '_platforms', '_region', '_regions', '_version', 'body', 'clean', 'dict', 'fill', 'filter', 'get', 'initialize', 'load', 'load_lazy_properties', 'locale', 'match_rule', 'match_server', 'metapipeline', 'metaroot', 'pipeline', 'platform', 'post', 'post_request', 'pre_request', 'put', 'qualkey', 'query', 'raw', 'rdict', 'region', 'setup', 'summoner', 'summoner_id', 'token', 'transform', 'version']
{'_meta': <pyot.models.lol.league.SummonerLeague.Meta object at 0x0000022B34F52F50>, 'summoner_id': 'CRyYy0X6Eu0mBbqLIZND_IYoixNORDK4kUG18ZdD2QC0EMM', '_platform': 'euw1'}

Both the name and the region are correct, the summoner is also ranked.

@activate_pipeline("lol") KeyError 'backend'

Sorry for creating an issue for this, but I don't know where I would otherwise get help from.
I am wondering what this error means:

Exception has occurred: KeyError
'backend'
  File "C:\Users\XXX\Realm-Wrap\backend\utils\pyotconf.py", line 18, in <module>
    @activate_pipeline("lol")
     ^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'backend'

I get this error when loading the pyotconf.py
I copied the pyotconf.py mostly from the docs and just made some minor changes, so I don't know what the problem is, since the error is not that much of a help.

from pyot.conf.model import activate_model, ModelConf
from pyot.conf.pipeline import activate_pipeline, PipelineConf
from dotenv import load_dotenv
import os

# Load env variables
load_dotenv(os.path.join(os.path.dirname(__file__), "..", ".env"))


@activate_model("lol")
class LolModel(ModelConf):
    default_platform = "euw1"
    default_region = "europe"
    default_version = "latest"
    default_locale = "en_us"


@activate_pipeline("lol")
class LolPipeline(PipelineConf):
    name = "lol_main"
    default = True
    stores = [
        {
            "BACKEND": "pyot.stores.riotapi.RiotAPI",
            "API_KEY": os.getenv("RIOT_API_KEY"),
            "RATE_LIMITER": {
                "BACKEND": "pyot.limiters.redis.RedisLimiter",
                "HOST": "redis",
                "PORT": 6379,
                "DB": 0,
                "LIMITING_SHARE": 0.9,
            }
        }
    ]

Unclear how to use external databases like MongoDB

I've been trying to figure out a way to utilize a MongoDB database as a long-term storage option that persists between runs of the application. The documentation provides very little information, and there are no examples of using MongoDB (or any other of the external stores) to retrieve/save information.

Is this functionality implemented yet? If so, can you expand on the documentation to provide examples of interfacing with the database?

Specifically, I want to save a lot of match information with something that looks like

summoner = await Summoner(...)
matches = await MatchHistory(puuid=summoner.puuid).query(count=10).get()
mongodb = ... # How do I access the database specified in the config?
for id in matches.ids:
    match = await Match(id=id).get()
    # Save the match to MongoDB
    mongodb.set( ... )

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.