fluxpoint
¶
Subpackages¶
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 |
|
Different requests types for the http request |
|
The base class for making http requests |
|
Images Api endpoints documented in https://bluedocs.page/fluxpoint-api/images |
|
GIFS Api endpoints documented in https://bluedocs.page/fluxpoint-api/gifs |
|
NSFW Api endpoints documented in https://bluedocs.page/fluxpoint-api/nsfw |
|
A class which gives info from the json data of about us |
|
A class which gives info from the json data of Minecraft server ping |
|
NSFW Api endpoints documented in https://bluedocs.page/fluxpoint-api/misc |
|
Class to configure the welcome image parameters |
|
Welcome Images Api endpoints documented in https://bluedocs.page/fluxpoint-api/welcome |
|
Square Image class |
|
Triangle Image class |
|
Circle Image class |
|
ImageUrl Image class |
|
Text class for custom image |
|
Custome image generator Api endpoints documented in https://bluedocs.page/fluxpoint-api/imagegen |
|
GIFS Api endpoints documented in https://bluedocs.page/fluxpoint-api/gifs |
|
Images Api endpoints documented in https://bluedocs.page/fluxpoint-api/images |
|
NSFW Api endpoints documented in https://bluedocs.page/fluxpoint-api/nsfw |
|
NSFW Api endpoints documented in https://bluedocs.page/fluxpoint-api/misc |
|
Welcome Images Api endpoints documented in https://bluedocs.page/fluxpoint-api/welcome |
|
Custome image generator Api endpoints documented in https://bluedocs.page/fluxpoint-api/imagegen |
|
The fluxpoint client where all the api routes are located |
|
Attributes¶
- fluxpoint.__title__ = fluxpoint¶
- fluxpoint.__author__ = Dhruva Shaw¶
- fluxpoint.__license__ = GNU GENERAL PUBLIC LICENSE¶
- fluxpoint.__copyright__ = Copyright 2021-present Dhruvacube¶
- fluxpoint.__version__ = 0.1.1¶
- fluxpoint.__path__¶
- class fluxpoint.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 fluxpoint.BaseHTTP(api_token)[source]¶
The base class for making http requests
- Parameters:
api_token (str) – The fluxpoint api token https://fluxpoint.dev/api/access
- __slots__ = ['api_token']¶
- await request(self, method, endpoint, json=None, headers=None, _base_url='https://api.fluxpoint.dev/', retry=True, return_json=True, return_bytes=False, 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 fluxpoint.HttpException(status, message)[source]¶
Bases:
Exception
Fluxpoint base exception class use this base class to catch any Fluxpoint errors.
- exception fluxpoint.ApiError(message)[source]¶
Bases:
HttpException
Raised when Fluxpoint has an error it does not know how to handle
- Parameters:
message (str) –
- exception fluxpoint.WrongReturnType[source]¶
Bases:
Exception
Exception raised when the when wrong return type is given
- exception fluxpoint.Unauthorised(message)[source]¶
Bases:
HttpException
Raised for an API 401
- Parameters:
message (str) –
- exception fluxpoint.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 fluxpoint.ParameterError(message)[source]¶
Bases:
HttpException
Parameters passed were not Sufficient
- Parameters:
message (str) –
- class fluxpoint.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 fluxpoint.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 fluxpoint.BaseHTTP(api_token)[source]¶
The base class for making http requests
- Parameters:
api_token (str) – The fluxpoint api token https://fluxpoint.dev/api/access
- __slots__ = ['api_token']¶
- await request(self, method, endpoint, json=None, headers=None, _base_url='https://api.fluxpoint.dev/', retry=True, return_json=True, return_bytes=False, 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:
- class fluxpoint.Images(api_token)[source]¶
Bases:
fluxpoint.http.BaseHTTP
Images Api endpoints documented in https://bluedocs.page/fluxpoint-api/images
- Parameters:
api_token (str) –
- class fluxpoint.Gifs(api_token)[source]¶
Bases:
fluxpoint.http.BaseHTTP
GIFS Api endpoints documented in https://bluedocs.page/fluxpoint-api/gifs
- Parameters:
api_token (str) –
- class fluxpoint.NSFW(api_token)[source]¶
Bases:
fluxpoint.http.BaseHTTP
NSFW Api endpoints documented in https://bluedocs.page/fluxpoint-api/nsfw
- Parameters:
api_token (str) –
- class fluxpoint.AboutUs(json_data)[source]¶
A class which gives info from the json data of about us
- Parameters:
json_data (dict) – The json data from the api
- Acessible Paramters:
- id:
[
int
] ID of the person- name:
[
str
] Discord username of the person- token:
[
str
] Fluxpoint token of the person- created:
[
datetime.datetime
] Account creation date- expire:
[Optional[
datetime.datetime
]] Expiration date- donator:
[
bool
] If the perso is a dontor in fluxpoint or not- owner:
[
bool
] If the person is owner or not- disabled:
[
bool
] If the acc is disabled or not- status:
[
str
] HTTP Status- code:
[
int
] HTTP Status code- message:
[
str
] Message returned by the api
- class fluxpoint.MinecraftPingData(json_data)[source]¶
A class which gives info from the json data of Minecraft server ping
- Parameters:
json_data (dict) – The json data from the api
- Acessible Paramters:
-
“motd”: [
str
] serverinfo :playersOnline: [int
] Amount of players online :playersMax: [int
] Max amount of players :version: [str
] Minecraft version :fullQuery: [bool
] If the query was full or not :players: [Optional[list
]] List of players :status: [str
] HTTP Status :code: [int
] HTTP Status code :message: [str
] Message returned by the api
- class fluxpoint.Misc(api_token)[source]¶
Bases:
fluxpoint.http.BaseHTTP
NSFW Api endpoints documented in https://bluedocs.page/fluxpoint-api/misc
- Parameters:
api_token (str) –
- await me(self)[source]¶
Get info on the current user
- Returns:
The class containing all the information about the current user
- Return type:
- class fluxpoint.WelcomeConfig(username, avatar, background, members=None, icon=None, banner=None, color_welcome=None, color_username=None, color_members=None)[source]¶
Class to configure the welcome image parameters
- Parameters:
username (str) – Discord username
avatar (Union[URL, str]) – avatar url
background (str) – Backgroud color code
members (Optional[str], optional) – Members no tet, defaults to None
icon (Optional[str], optional) – Icon to use, defaults to None
banner (Optional[str], optional) – Banner to be put at background, defaults to None
color_welcome (Optional[str], optional) – Colour of the welcome text, defaults to None
color_username (Optional[str], optional) – Colour of the username text, defaults to None
color_members (Optional[str], optional) – Colour of the member text, defaults to None
Note
The
color
parameters are optional, if you don’t want to use a color, just passNone
Warning
The
banner
andicon
parameters evauation would be done whenWelcome.welcome()
is called.
- class fluxpoint.Welcome(api_token)[source]¶
Bases:
fluxpoint.http.BaseHTTP
Welcome Images Api endpoints documented in https://bluedocs.page/fluxpoint-api/welcome
- Parameters:
api_token (str) –
- await welcome(self, config)[source]¶
Create a welcome image
- Raises:
InvalidFeature – When
banner
oricons
parameters inconfig
are invalid- Parameters:
config (WelcomeConfig) – A WelcomeConfig object
- Returns:
The image as a byte array
- Return type:
- class fluxpoint.Square(width, height, color=None, round=None, x=None, y=None)[source]¶
Square Image class
- Parameters:
width (int) – Set the width of the shape
height (int) – Set the height of the shape
color (Optional[str], optional) – Set the shape to be a color from name/hex/rgb/rgba use rgba for transparency, defaults to None
round (Optional[int], optional) – Make the borders of the shape round. (Default 0), defaults to None
x (Optional[int], optional) – Position the image in pixels, defaults to None
y (Optional[int], optional) – Position the image in pixels, defaults to None
- __slots__ = ['width', 'height', 'color', 'round', 'x', 'y']¶
- class fluxpoint.Triangle(width, height, cut, color=None, x=None, y=None)[source]¶
Triangle Image class
- Parameters:
color (Optional[str]) – Set the shape to be a color from name/hex/rgb/rgba use rgba for transparency
width (int) – Set the width of the shape
height (int) – Set the height of the shape
cut (Literal[topleft, topright, bottomleft, bottomright]) – Choose where the missing peice of the triangle is
x (Optional[int], optional) – Position the image in pixels, defaults to None
y (Optional[int], optional) – Position the image in pixels, defaults to None
- __slots__ = ['width', 'height', 'cut', 'color', 'x', 'y']¶
- class fluxpoint.Circle(color=None, radius=None, x=None, y=None)[source]¶
Circle Image class
- Parameters:
color (Optional[str]) – Set the shape to be a color from name/hex/rgb/rgba use rgba for transparency
radius (Optional[int]) – Set the size of the circle from the center point
x (Optional[int], optional) – Position the image in pixels, defaults to None
y (Optional[int], optional) – Position the image in pixels, defaults to None
- __slots__ = ['color', 'radius', 'x', 'y']¶
- class fluxpoint.ImageUrl(url, cache=False, width=None, height=None, maxwidth=None, maxheight=None, round=None, x=None, y=None)[source]¶
ImageUrl Image class
- Parameters:
url (str) – https://website.com/image.png
cache (Optional[bool], optional) – Cache the image server-side so it can be easily loaded again such as background images. (Not Recommended for Avatars), defaults to False
width (Optional[int], optional) – Set the width of the image, defaults to None
height (Optional[int], optional) – Set the height of the image, defaults to None
maxwidth (Optional[int], optional) – Set the max width so the image can scale properly, defaults to None
maxheight (Optional[int], optional) – Set the max height so the image can scale properly, defaults to None
round (Optional[int], optional) – Make the borders of the image round for stuff like circle avatars, defaults to None
x (Optional[int], optional) – Position the image in pixels, defaults to None
y (Optional[int], optional) – Position the image in pixels, defaults to None
- __slots__ = ['url', 'cache', 'width', 'height', 'maxwidth', 'maxheight', 'round']¶
- class fluxpoint.Text(text, size=16, font='Sans Serif', color='white', back=None, x=0, y=0, align='l', bold=False, italics=False, underline=False, line=1.0, weight=500, width=None, height=None, outline=False, outlinewidth=9, outlinecolor='black', outlineblur=1)[source]¶
Text class for custom image
- Parameters:
text (str) – Set the text
size (Optional[int], optional) – Set the font size of the text, defaults to 16
font (Optional[str], optional) – Set the font to use for the text, defaults to “Sans Serif”
color (Optional[str], optional) – Set the text color from name/hex/rgb/rgba use rgba for transparency, defaults to “white”
back (Optional[str], optional) – Set the background color for the text box from name/hex/rgb/rgba use rgba for transparency, defaults to None
x (Optional[int], optional) – Position the text in pixels, defaults to 0
y (Optional[int], optional) – Position the text in pixels, defaults to 0
align (Optional[Literal[l,m,r]], optional) – Align the text from left/center/right (Default left), defaults to “l”
bold (Optional[bool], optional) – Set the text to bold style, defaults to False
italics (Optional[bool], optional) – Set the text to italics style, defaults to False
underline (Optional[bool], optional) – Set the text to underline style, defaults to False
line (Optional[float], optional) – Set the text to underline style, defaults to 1.0
weight (Optional[int], optional) – Increase the boldness of the tex, defaults to 500
width (Optional[int], optional) – Set the max width of the text box before it wraps to a newline, defaults to None
height (Optional[int], optional) – et the max height of the text box to clip extra text, defaults to None
outline (Optional[bool], optional) – Show text outline with default options, defaults to False
outlinewidth (Optional[int], optional) – Set the outline size from the text, defaults to 9
outlinecolor (Optional[str], optional) – Set the outline color from name/hex/rgb/rgba use rgba for transparency, defaults to “black”
outlineblur (Optional[int], optional) – Make the outline transparency less visible for a cool effect, defaults to 1
- __slots__ = ['text', 'size', 'font', 'color', 'back', 'x', 'y', 'align', 'bold', 'italics', 'underline',...¶
- class fluxpoint.ImageGenerator(api_token)[source]¶
Bases:
fluxpoint.http.BaseHTTP
Custome image generator Api endpoints documented in https://bluedocs.page/fluxpoint-api/imagegen
- Parameters:
api_token (str) –
- await test(self)[source]¶
Test the image generator
- Returns:
The response from the server
- Return type:
Union[Dict, io.IOBase]
- await customimage(self, type, width, height, color, images=None, texts=None)[source]¶
Get the created image gen image.
- Parameters:
type (Literal[bitmap, image]) – Image type
width (int) – Overall width of the image
height (int) – Overall height of the image
color (str) – Background colour of the image
images (Optional[List[Union[ImageUrl, Square, Triangle, Circle]]], optional) – The image(s) that you want to embed in image, defaults to []
texts (Optional[List[Text]], optional) – The text(s) that you want to embed in image, defaults to []
- Returns:
The custom generated image bytes data
- Return type:
Union[Dict, io.IOBase]
- class fluxpoint.Gifs(api_token)[source]¶
Bases:
fluxpoint.http.BaseHTTP
GIFS Api endpoints documented in https://bluedocs.page/fluxpoint-api/gifs
- Parameters:
api_token (str) –
- class fluxpoint.Images(api_token)[source]¶
Bases:
fluxpoint.http.BaseHTTP
Images Api endpoints documented in https://bluedocs.page/fluxpoint-api/images
- Parameters:
api_token (str) –
- class fluxpoint.NSFW(api_token)[source]¶
Bases:
fluxpoint.http.BaseHTTP
NSFW Api endpoints documented in https://bluedocs.page/fluxpoint-api/nsfw
- Parameters:
api_token (str) –
- class fluxpoint.Misc(api_token)[source]¶
Bases:
fluxpoint.http.BaseHTTP
NSFW Api endpoints documented in https://bluedocs.page/fluxpoint-api/misc
- Parameters:
api_token (str) –
- await me(self)[source]¶
Get info on the current user
- Returns:
The class containing all the information about the current user
- Return type:
- class fluxpoint.Welcome(api_token)[source]¶
Bases:
fluxpoint.http.BaseHTTP
Welcome Images Api endpoints documented in https://bluedocs.page/fluxpoint-api/welcome
- Parameters:
api_token (str) –
- await welcome(self, config)[source]¶
Create a welcome image
- Raises:
InvalidFeature – When
banner
oricons
parameters inconfig
are invalid- Parameters:
config (WelcomeConfig) – A WelcomeConfig object
- Returns:
The image as a byte array
- Return type:
- class fluxpoint.ImageGenerator(api_token)[source]¶
Bases:
fluxpoint.http.BaseHTTP
Custome image generator Api endpoints documented in https://bluedocs.page/fluxpoint-api/imagegen
- Parameters:
api_token (str) –
- await test(self)[source]¶
Test the image generator
- Returns:
The response from the server
- Return type:
Union[Dict, io.IOBase]
- await customimage(self, type, width, height, color, images=None, texts=None)[source]¶
Get the created image gen image.
- Parameters:
type (Literal[bitmap, image]) – Image type
width (int) – Overall width of the image
height (int) – Overall height of the image
color (str) – Background colour of the image
images (Optional[List[Union[ImageUrl, Square, Triangle, Circle]]], optional) – The image(s) that you want to embed in image, defaults to []
texts (Optional[List[Text]], optional) – The text(s) that you want to embed in image, defaults to []
- Returns:
The custom generated image bytes data
- Return type:
Union[Dict, io.IOBase]
- class fluxpoint.FluxpointClient(api_token)[source]¶
Bases:
fluxpoint.paths.Gifs
,fluxpoint.paths.Images
,fluxpoint.paths.NSFW
,fluxpoint.paths.Misc
,fluxpoint.paths.Welcome
,fluxpoint.paths.ImageGenerator
The fluxpoint client where all the api routes are located
- Parameters:
api_token (str) –
- exception fluxpoint.HttpException(status, message)[source]¶
Bases:
Exception
Fluxpoint base exception class use this base class to catch any Fluxpoint errors.
- exception fluxpoint.ApiError(message)[source]¶
Bases:
HttpException
Raised when Fluxpoint has an error it does not know how to handle
- Parameters:
message (str) –
- exception fluxpoint.WrongReturnType[source]¶
Bases:
Exception
Exception raised when the when wrong return type is given
- exception fluxpoint.Unauthorised(message)[source]¶
Bases:
HttpException
Raised for an API 401
- Parameters:
message (str) –
- exception fluxpoint.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 fluxpoint.ParameterError(message)[source]¶
Bases:
HttpException
Parameters passed were not Sufficient
- Parameters:
message (str) –
- class fluxpoint.VersionInfo¶
Bases:
NamedTuple
- major :int¶
- minor :int¶
- micro :int¶
- releaselevel :Literal[alpha, beta, candidate, final]¶
- serial :int¶
- fluxpoint.version_info :VersionInfo¶