Handlers

Submodules

Rate Limit Modules

See riotwatcher.Handlers.RateLimit package for more info

class riotwatcher.Handlers.RateLimiterAdapter.RateLimiterAdapter(limiter: riotwatcher.RateLimiter.RateLimiter)

Bases: riotwatcher.Handlers.RequestHandler.RequestHandler

after_request(region: str, endpoint_name: str, method_name: str, url: str, response: requests.models.Response) → requests.models.Response

Called after a response is received and before it is returned to the user.

Parameters:
  • region (string) – the region of this request
  • endpoint_name (string) – the name of the endpoint that was requested
  • method_name (string) – the name of the method that was requested
  • url – The url that was requested
  • response – the response received. This is a response from the “requests” library
preview_request(region: str, endpoint_name: str, method_name: str, url: str, query_params: dict)

called before a request is processed.

Parameters:
  • region (string) – the region of this request
  • endpoint_name (string) – the name of the endpoint being requested
  • method_name (string) – the name of the method being requested
  • url – the URL that is being requested.
  • query_params – dict: the parameters to the url that is being queried, e.g. ?key1=val&key2=val2

Serialization Modules

class riotwatcher.Handlers.DictionaryDeserializer.DictionaryDeserializer

Bases: riotwatcher.Deserializer.Deserializer

deserialize(endpoint_name: str, method_name: str, data: str) → dict
class riotwatcher.Handlers.DeserializerAdapter.DeserializerAdapter(deserializer: riotwatcher.Deserializer.Deserializer)

Bases: riotwatcher.Handlers.RequestHandler.RequestHandler

after_request(region: str, endpoint_name: str, method_name: str, url: str, response: requests.models.Response) → Any

Called after a response is received and before it is returned to the user.

Parameters:
  • region (string) – the region of this request
  • endpoint_name (string) – the name of the endpoint that was requested
  • method_name (string) – the name of the method that was requested
  • url – The url that was requested
  • response – the response received. This is a response from the “requests” library
after_static_request(url: str, response: requests.models.Response) → Any

Called after a response is received and before it is returned to the user.

Parameters:
  • url – The url that was requested
  • response – the response received. This is a response from the “requests” library

Error Handler Modules

class riotwatcher.Handlers.DeprecationHandler.DeprecationHandler

Bases: riotwatcher.Handlers.RequestHandler.RequestHandler

after_request(region: str, endpoint_name: str, method_name: str, url: str, response: requests.models.Response) → requests.models.Response

Called after a response is received and before it is returned to the user.

Parameters:
  • region (string) – the region of this request
  • endpoint_name (string) – the name of the endpoint that was requested
  • method_name (string) – the name of the method that was requested
  • url – The url that was requested
  • response – the response received. This is a response from the “requests” library
class riotwatcher.Handlers.ThrowOnErrorHandler.ThrowOnErrorHandler

Bases: riotwatcher.Handlers.RequestHandler.RequestHandler

after_request(region: str, endpoint_name: str, method_name: str, url: str, response: requests.models.Response) → None

Called after a response is received and before it is returned to the user.

Parameters:
  • region (string) – the region of this request
  • endpoint_name (string) – the name of the endpoint that was requested
  • method_name (string) – the name of the method that was requested
  • url – The url that was requested
  • response – the response received. This is a response from the “requests” library
class riotwatcher.Handlers.TypeCorrectorHandler.TypeCorrectorHandler

Bases: riotwatcher.Handlers.RequestHandler.RequestHandler

The TypeCorrector class is meant to correct any inconsistencies in the types of objects provided as query parameters.

Currently this only involves changing boolean values into strings, as the API only accepts lower case booleans for some reason.

preview_request(region: str, endpoint_name: str, method_name: str, url: str, query_params: dict)

called before a request is processed.

Parameters:
  • endpoint_name (string) – the name of the endpoint being requested
  • method_name (string) – the name of the method being requested
  • url – the URL that is being requested.
  • query_params – dict: the parameters to the url that is being queried, e.g. ?key1=val&key2=val2

Request Handler Modules

class riotwatcher.Handlers.RequestHandler.RequestHandler

Bases: object

after_request(region: str, endpoint_name: str, method_name: str, url: str, response)

Called after a response is received and before it is returned to the user.

Parameters:
  • region (string) – the region of this request
  • endpoint_name (string) – the name of the endpoint that was requested
  • method_name (string) – the name of the method that was requested
  • url – The url that was requested
  • response – the response received. This is a response from the “requests” library
after_static_request(url: str, response)

Called after a response is received and before it is returned to the user.

Parameters:
  • url – The url that was requested
  • response – the response received. This is a response from the “requests” library
preview_request(region: str, endpoint_name: str, method_name: str, url: str, query_params: dict)

called before a request is processed.

Parameters:
  • region (string) – the region of this request
  • endpoint_name (string) – the name of the endpoint being requested
  • method_name (string) – the name of the method being requested
  • url – the URL that is being requested.
  • query_params – dict: the parameters to the url that is being queried, e.g. ?key1=val&key2=val2
preview_static_request(url: str, query_params: dict)

Called before a request to DataDragon is processed

Parameters:url – The url that was requested