statspost
¶
Submodules¶
Package Contents¶
Classes¶
Different requests types for the http request |
|
The base class for making http requests |
|
Different requests types for the http request |
|
A type safe sentinel for the None type. |
|
Different requests types for the http request |
|
The base class for making http requests |
|
The client to post stats |
|
Attributes¶
Type hint for the supported Botlists |
|
List of Botlists supported |
|
- statspost.__title__ = statspost¶
- statspost.__author__ = Dhruva Shaw¶
- statspost.__license__ = MIT¶
- statspost.__copyright__ = Copyright 2022-present Dhruvacube¶
- statspost.__version__ = 1.0.1¶
- statspost.__path__¶
- statspost.MISSING :Any¶
- class statspost.RequestTypes[source]¶
Bases:
enum.IntEnum
Different requests types for the http request
- DELETE = 0¶
- GET = 1¶
- HEAD = 2¶
- PATCH = 3¶
- PUT = 4¶
- POST = 5¶
- class statspost.BaseHTTP[source]¶
The base class for making http requests
- silently_fail :bool = True¶
- __slots__ = []¶
- await request(method, _base_url, api_token, json=MISSING, headers=MISSING, bot=False, bots=False, retry=True, retry_times=1)[source]¶
Makes an API request
- Raises:
RateLimited – When the 429 response is returned
WrongReturnType – When the
UnicodeDecodeError
is raisedParameterError – When the 400 response is returned
Unauthorised – When the 401 response is returned
ApiError – When the 500 response is returned
HttpException – For the other and generall http exceptions
- Returns:
Bytes data for the image
- Return type:
Union[aiohttp.ClientResponse, dict, io.IOBase]
- Parameters:
- exception statspost.HttpException(status, message)[source]¶
Bases:
Exception
AsyncDagpi base exception class use this base class to catch any AsyncDagpi errors.
- exception statspost.ApiError(message)[source]¶
Bases:
HttpException
Raised when Fluxpoint has an error it does not know how to handle
- Parameters:
message (str) –
- exception statspost.WrongReturnType[source]¶
Bases:
Exception
Exception raised when the when wrong return type is given
- exception statspost.Unauthorised(message)[source]¶
Bases:
HttpException
Raised for an API 401
- Parameters:
message (str) –
- exception statspost.RateLimited(message)[source]¶
Bases:
HttpException
You are exceeding the API’s rate limits and built in Ratelimit handler Essentially a 429
- Parameters:
message (str) –
- exception statspost.ParameterError(message)[source]¶
Bases:
HttpException
Parameters passed were not Sufficient
- Parameters:
message (str) –
- class statspost.RequestTypes[source]¶
Bases:
enum.IntEnum
Different requests types for the http request
- DELETE = 0¶
- GET = 1¶
- HEAD = 2¶
- PATCH = 3¶
- PUT = 4¶
- POST = 5¶
- exception statspost.HttpException(status, message)[source]¶
Bases:
Exception
AsyncDagpi base exception class use this base class to catch any AsyncDagpi errors.
- exception statspost.ApiError(message)[source]¶
Bases:
HttpException
Raised when Fluxpoint has an error it does not know how to handle
- Parameters:
message (str) –
- exception statspost.WrongReturnType[source]¶
Bases:
Exception
Exception raised when the when wrong return type is given
- exception statspost.Unauthorised(message)[source]¶
Bases:
HttpException
Raised for an API 401
- Parameters:
message (str) –
- exception statspost.RateLimited(message)[source]¶
Bases:
HttpException
You are exceeding the API’s rate limits and built in Ratelimit handler Essentially a 429
- Parameters:
message (str) –
- exception statspost.ParameterError(message)[source]¶
Bases:
HttpException
Parameters passed were not Sufficient
- Parameters:
message (str) –
- class statspost._MissingSentinel¶
A type safe sentinel for the None type.
- __slots__ = []¶
- __eq__(other)¶
Return self==value.
- __bool__()¶
- __hash__()¶
Return hash(self).
- __repr__()¶
Return repr(self).
- __iter__()¶
- __len__()¶
- statspost.MISSING :Any¶
- statspost.MISSING :Any¶
- class statspost.RequestTypes[source]¶
Bases:
enum.IntEnum
Different requests types for the http request
- DELETE = 0¶
- GET = 1¶
- HEAD = 2¶
- PATCH = 3¶
- PUT = 4¶
- POST = 5¶
- class statspost.BaseHTTP[source]¶
The base class for making http requests
- silently_fail :bool = True¶
- __slots__ = []¶
- await request(method, _base_url, api_token, json=MISSING, headers=MISSING, bot=False, bots=False, retry=True, retry_times=1)[source]¶
Makes an API request
- Raises:
RateLimited – When the 429 response is returned
WrongReturnType – When the
UnicodeDecodeError
is raisedParameterError – When the 400 response is returned
Unauthorised – When the 401 response is returned
ApiError – When the 500 response is returned
HttpException – For the other and generall http exceptions
- Returns:
Bytes data for the image
- Return type:
Union[aiohttp.ClientResponse, dict, io.IOBase]
- Parameters:
- statspost.SUPPORTED_BOTLISTS¶
Type hint for the supported Botlists
- statspost.VALID_BOTLISTS :Iterable¶
List of Botlists supported - topgg - discordbotlist - bladelist - discordbotsgg - discordlabs - discord-botlist.eu - yabl - voidbots - radarbotdirectory - blist - botlist.me - discords - infinity - motiondevelopment - discordservices - vcodes - discordz - disforge - topicList
- class statspost.StatsPost(*args, **kwargs)[source]¶
Bases:
statspost.http.BaseHTTP
The client to post stats
- Raises:
ValueError – When one of the default values is missing
- botclass :Union[discord.Client, discord.AutoShardedClient, discord.ext.commands.Bot, discord.ext.commands.AutoShardedBot]¶
- botlist_data :Mapping[SUPPORTED_BOTLISTS, str]¶
- retry :bool = True¶
- retry_times :int = 10¶
- add_botlist(botlist, token)[source]¶
A helper function to add a botlist from the list of supported botliss
- Parameters:
botlist (SUPPORTED_BOTLISTS) – Botlist name
token (str) – The token provided by the botlist
- Return type:
None
- await post_stats(return_post_data: Optional[bool] = None) Dict [source]¶
- await post_stats(return_post_data=MISSING) None
Start posting stats from listed of provided botlist
- Parameters:
return_post_data (Optional[bool], optional) – The post data return by the botlist, defaults to False
- Raises:
NoBotListData – When this function is ran without providing botlist data to the client
- Returns:
The post data is returned is asked else None is returned.
- Return type:
Union[Dict, None]
- class statspost.VersionInfo¶
Bases:
NamedTuple
- major :int¶
- minor :int¶
- micro :int¶
- releaselevel :Literal[alpha, beta, candidate, client.final]¶
- serial :int¶
- statspost.version_info :VersionInfo¶