Objects
Pyot provides many models, each model contains Pyot classes, and these classes creates instances of Pyot objects. Different types of Pyot objects has different structure and functionalities.
Module: pyot.core.objects
Pyot Static
Base class: PyotStaticBase
Takes a Python data and serialize it into Python objects based on defined type hints of its subclass. Attributes may return other Pyot Static objects, these objects are initially not serialized, instead are assigned as instances of PyotLazy, these objects will only be serialized upon first access of the attribute.
class PyotStaticBase
PyotStaticBaseMetaclass: PyotMetaClass
Extends: PyotRoutingBase
Definitions:
__getitem__->AnySupports
object[item]syntax, by using this syntax instead ofobject.itemwill return the.dict()representation ofobject.item, useful for avoiding serialization ofobject.itembeforehand if unwanted.
Attributes:
_meta:Self.Meta
Properties:
region->strplatform->strversion->strlocale->strmetaroot->PyotCoreBaseReturns the root Pyot Core object which this object is child of.
metapipeline->PipelineReturns the pipeline of this object's class' model.
Methods:
method
dict->Dictforce_copy:bool = FalseForce make deep copy before returning, default to
Falsefor shallow copy.lazy_props:bool = FalseTrue for loading all
lazy_propertys before returning, False otherwise.recursive:bool = FalseTrue for returning
rdict()content instead.
Returns the Python dict that is used for serialization on this object.
method
rdict->DictReturns the Python representation of object by doing recursive walks on itself.
Pyot Core
Base class: PyotCoreBase
Inherits all functionalities of PyotStaticBase. This type of objects has the ability to request for data on pipelines.
class PyotCoreBase
PyotCoreBaseExtends: PyotStaticBase
Methods:
using->Nonepipeline_name:str
Set the pipeline used for request in this instance.
query->SelfAdd query parameters to the request. This method is only present if the class accepts query parameters.
body->SelfAdd body parameters to the request. This method is only present if the class requires body parameters.
async
token->PipelineTokenCreate a pipeline token that identifies this object.
async
get->Selfforce_copy:bool = False
Make a GET request to the pipeline.
force_copy: Force make a deep copy on raw before serializing, default toFalsefor smart copy (multi-level shallow copy).
async
post->Selfforce_copy:bool = False
Make a POST request to the pipeline.
force_copy: Force make a deep copy on raw before serializing, default toFalsefor smart copy (multi-level shallow copy).
async
put->Selfforce_copy:bool = False
Make a PUT request to the pipeline.
force_copy: Force make a deep copy on raw before serializing, default toFalsefor smart copy (multi-level shallow copy).
raw->AnyReturns the raw response of the request, by default smart copy is used, therefore there could be differences and should not be modified, a safer option is use
force_copyflag to do deepcopy of the response at the cost of performance.classmethod
load->Selfraw:Any
Return an instance of the class and load the submitted raw data.
Pyot Utils
Base class: PyotUtilBase
This type of objects are meant to be utilities objects. The definition of this base class is empty, it is only used for generating documentations and possible usecases involving isinstance.
Example
Get ranked solo/duo match ids of the last 24 hours for a summoner by name and platform. Assuming model is activated and pipeline properly configured.
from datetime import datetime, timedelta
from pyot.models import lol
from pyot.utils.lol.routing import platform_to_region
async def get_match_ids(name: str, platform: str) -> List[str]:
summoner = await lol.Summoner(name=name, platform=platform).get()
match_history = await lol.MatchHistory(
puuid=summoner.puuid,
region=platform_to_region(summoner.platform)
).query(
count=100,
queue=420,
start_time=datetime.now() - timedelta(days=200)
).get()
return match_history.idsLast updated