statspost

Submodules

Package Contents

Classes

RequestTypes

Different requests types for the http request

BaseHTTP

The base class for making http requests

RequestTypes

Different requests types for the http request

_MissingSentinel

A type safe sentinel for the None type.

RequestTypes

Different requests types for the http request

BaseHTTP

The base class for making http requests

StatsPost

The client to post stats

VersionInfo

Attributes

statspost.__title__ = statspost
statspost.__author__ = Dhruva Shaw
statspost.__license__ = MIT
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:
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.

Parameters:
  • status (int) –

  • message (str) –

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) –

exception statspost.NoBotListData[source]

Bases: Exception

No botlist data provided

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.

Parameters:
  • status (int) –

  • message (str) –

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) –

exception statspost.NoBotListData[source]

Bases: Exception

No botlist data provided

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
exception statspost.NoBotListData[source]

Bases: Exception

No botlist data provided

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:
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
__str__()[source]

Return str(self).

Return type:

str

__repr__()[source]

Return repr(self).

Return type:

str

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