-
Notifications
You must be signed in to change notification settings - Fork 1
Exceptions
This section of the documentation covers the custom exceptions that are raised by the Some Random API Python library. When using the library, you may encounter one of these exceptions if there is an issue with your request or if an error occurs while processing your request.
This error is raised when the status code returned by the URL of an image is not 200
. This can happen if the URL is invalid or if the image is not available anymore. To resolve this issue, you can try again to see if you can obtain a valid link or check if the image is still available. It's not recommended to use an invalid URL as it can lead to unexpected behavior and errors in your program.
The InvalidFileFormat
error is raised when the file format specified for saving the image locally is not supported, i.e., it must be either .png
, .jpg
, or .jpeg
. To resolve this issue, you can change the file format to one of the supported formats.
The APITimeout
error is typically raised when the API fails to respond within a reasonable time. Slow internet connection can also cause this error to be raised. To resolve this issue, you can try again. You can also check your internet connection to ensure it is stable.
This error is typically encountered when an API returns a status code other than 200
. It may also occur if the API is currently unavailable. To resolve this issue, you can try again later when the API is likely to be operational.
The ImageRetrieveError
exception is raised when the library fails to save the image locally. This can happen due to slow network speed or if the image file is corrupted during the saving process. You may still be able to use the image URL to retrieve the image manually.
This error is raised when the Avatar URL does not start with http
/https
or when the Avatar URL does not end with .png
or .jpg
. You can fix this issue by double-checking the URL and making sure that it starts with http
/https
and ends with .png
or .jpg
.
This error is raised when the Avatar URL does not start with http
/https
. You can fix this issue by double-checking the URL and making sure that it starts with http
/https
.
This error is raised when the given HEX Color Code is not 6
or 8
characters in length. The error message will indicate the length of the given code. To resolve this issue, ensure that the HEX Color Code is exactly 6
or 8
characters in length.
The InvalidBrightnessPower error is raised when the provided brightness power is outside the valid range of 0-255
. To fix this issue, ensure that the brightness power value is within this range.
This error is raised when the RGB Color Code provided doesn't contain 3
blocks. RGB Color Code should contain three values for Red
, Green
, and Blue
colors respectively. To issue please provide a valid RGB Color Code with three blocks.
This error is raised when the length of the display name is greater than 32
characters. The display name must be lesser than 32
characters.
This error is raised when the length of the username is greater than 15
characters. The username must be lesser than 15
characters.
This error is raised when the length of the comment is greater than 1000
characters. The comment must be lesser than 1000
characters.
ThemeError
is raised when an invalid theme is given. The valid options for theme are light
, dark
, or dim
. Please make sure to choose one of these options for the theme parameter.
InvalidTemplate
is raised when an invalid template integer is given. The theme integer must be within 1 - 7
.
InvalidBackground
is raised when an invalid background is given. The valid options for background are stars
, stars2
, rainbowgradient
, rainbow
, sunset
, night
, blobday
, blobnight
, space
, gaming1
, gaming2
, gaming3
or gaming4
. Make sure to choose one of these options as background.
InvalidFont
is raised when an invalid font integer is given. The font integer must be within 1 - 10
InvalidType
is raised when an invalid Type is given. Type must be join
or leave
InvalidTextColor
is raised when an invalid Text Color is given. Text Color must be red
, orange
, yellow
, green
, blue
, indigo
, purple
, pink
, black
or white
.
ThresholdError
is raised when an invalid Threshold Power is given. Threshold Power must be within 0 - 255
sra-pylib by Sayad Uddin Tahsin
-
Animal
-
Animu
-
Canvas
-
Facts
-
Image
-
Others
-
Pokemon
-
Chatbot
-
Welcome (Free)
- ImageNotFound
- InvalidFileFormat
- APITimeout
- APIError
- ImageRetrieveError
- InvalidAvatarURL
- InvalidImageURL
- InvalidHEXColor
- InvalidBrightnessPower
- InvalidRGBCode
- DisplayNameError
- UsernameError
- CommentError
- ThemeError
- InvalidTemplate
- InvalidBackground
- InvalidFont
- InvalidType
- InvalidTextColor
- ThresholdError