pastegram-py
A set of simple functions to upload and fetch pastes on paste.uploadgram.me.
API Documentation
Methods
upload_paste(contents: bytes, filename: str) -> UploadedPaste:
Uploads a paste.
| argument | required | default |
|---|---|---|
| contents | yes | |
| filename | no | paste |
Returns: the UploadedPaste
fetch_paste(url: str) -> str
Fetches the paste and returns the contents as string.
| argument | required | default |
|---|---|---|
| url | yes |
Returns: The paste's contents as string
Types
UploadedPaste
An uploaded paste
Fields
| field | type | description |
|---|---|---|
| token | str | An unique token that can be used to delete the paste |
| downloadId | str | The paste's download id |
| key | bytes | The paste's decryption key as bytes |
Methods
UploadedPaste.get_url() -> str
Gets the paste's shareable url
Errors
ParseError
Raised when an error occurs while parsing. May be thrown by fetch_paste()
APIError
Raised when an error occurs while fetching/parsing an API reponse. May be thrown by upload_paste()
Examples
Upload a paste and fetch it back
from pastegram import upload_paste, fetch_paste, UploadedPaste
def main():
print('uploading paste...')
paste: UploadedPaste = upload_paste(b'hello')
print(paste.token)
print(paste.get_url())
print('re-downloading paste...')
contents: str = fetch_paste(paste.get_url())
print(contents)
if __name__ == '__main__':
main()
Metadata
Release files for pastegram 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pastegram-1.0.1.tar.gz | 4.2 kB | Without provenance | Details for pastegram-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pastegram-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for pastegram-1.0.1-py3-none-any.whl |
Total release size: 9.6 kB
Release files / pastegram-1.0.1.tar.gz
| Download URL | pastegram-1.0.1.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c123c584cc635b322b1c3cb6e3b530804f9d86bbd856d3eda06d91951bc5dad3
|
|
BLAKE2b-256 checksum How to use checksums |
e3f6b52fb7e33285ed1b365c038f1fb8b74bed833b3164631fde16def585f82d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1
|
Release files / pastegram-1.0.1-py3-none-any.whl
| Download URL | pastegram-1.0.1-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f76b61d5585873dee15387251a83e9653164fdae6a507784e621b76d1af678fe
|
|
BLAKE2b-256 checksum How to use checksums |
c7c6fb4addfacc55a321c71f8e8a7aa49c5aa643a4ab9856b6b0767216b6cccd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1
|
Security for pastegram 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.