paste_service¶
- class PasteResponse[source]¶
Bases:
TypedDict
A successful response from the paste service.
- Parameters:
link – The URL to the saved paste.
removal – The URL to delete the saved paste.
- exception PasteTooLongError[source]¶
Bases:
Exception
Raised when content is too large to upload to the paste service.
- exception PasteUploadError[source]¶
Bases:
Exception
Raised when an error is encountered uploading to the paste service.
- async send_to_paste_service(*, contents, paste_url, http_session, file_name='', lexer='python', max_size=131072)[source]¶
Upload some contents to the paste service.
- Parameters:
contents (
str
) – The content to upload to the paste service.paste_url (
str
) – The base url to the paste service.http_session (aiohttp.ClientSession) – The session to use when POSTing the content to the paste service.
file_name (
str
) – The name of the file to save to the paste service.lexer (
str
) – The lexer to save the content with.max_size (
int
) – The max number of bytes to be allowed. Anything larger thanMAX_PASTE_SIZE
will be rejected.
- Raises:
ValueError –
max_length
greater than the maximum allowed by the paste service.PasteTooLongError –
contents
too long to upload.PasteUploadError – Uploading failed.
- Return type:
- Returns:
A
TypedDict
containing both the URL of the paste, and a URL to remove the paste.