Pasteconnect package
PasteConnect is a Python library for interacting with Pastebin. It allows you to check account validity, authenticate, create pastes, delete pastes, and retrieve raw paste content.
Installation
Python 3.7 or higher is required.
You can install PasteConnect using pip:
+$ pip install pasteconnect
Install from source repository
+$ pip install git+https://github.com/heartlog/pasteconnect.git
Getting Started
To get(create) your
username,password» login to your pastebin accountafter creating your account, head over to the api documentation and grab your
api_keyunder Your Unique Developer API Key
Usage
from pasteconnect import PasteConn
# Sync Client
pastebin = PasteConn(username, password, api_key)
# Account_status(check validity of account)
account_status = pastebin.check_account()
print(account_status)
title = "My Paste Title"
content = "This is the content of my paste."
# Paste text to pastebin
paste_url = pastebin.create_paste(title, content, privacy=1)
print(f"Paste created: {paste_url}")
Initialize client
pastebin = PasteConn(username, password, api_key) 
-required for other modules to work
Refer Getting Started
username = "username"
password = "*******"
api_key = "123456abcdefg"
# Define Client
pastebin = PasteConn(username, password, api_key)
Alternatively, you can initialize with predefined environment variables
pastebin = PasteConn() # with pre define env var
Check account existance
pastebin.check_account()
Check validity of pastebin.com account.
result = pastebin.check_account()
print(result) # Response: '[heartlog] is Valid Account. User key : "user_key"'
Authentication
To authenticate and get your user_key:
pastebin.auth()
Get user_key using give credentials.
result = pastebin.auth()
print(result) # Response: "user_key"
pastebin.create_paste(title, content, privacy=1)
# 0 : public | 1 : unlisted | 2 : private
privacy = 1 # (default - private)
title = "Title of paste"
content = """
Hello
This is multiline text
"""
pastebin.create_paste(title, content, privacy=1)
pastebin.delete_paste(url)
url = "https://pastebin.com/kZATAWhe"
result = pastebin.delete_paste(url)
print(result) # Response: "Paste Removed"
Get raw content
To retrieve the raw content of a paste using its URL or ID:
pastebin.get_raw_content(url)
from pasteconnect import get_raw
result = get_raw(url)
print(result)
Alternatively, you can use the get_raw function:
url = "https://pastebin.com/kZATAWhe"
result = pastebin.get_raw_content(url)
print(result) # Response: "Content of paste"
Made with ❤️ by Heartlog
Special Thanks
venaxyt for pastebinapi. Helped a lot in project. 😁
Metadata
Release files for pasteconnect 0.6.2
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 |
|---|---|---|---|---|
| pasteconnect-0.6.2.tar.gz | 5.4 kB | Without provenance | Details for pasteconnect-0.6.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pasteconnect-0.6.2-py3-none-any.whl | Python 3 | none | any | Details for pasteconnect-0.6.2-py3-none-any.whl |
Total release size: 11.4 kB
Release files / pasteconnect-0.6.2.tar.gz
| Download URL | pasteconnect-0.6.2.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0524d090bc3c955ececf0a779fc2689b29822d0c3c440a157c39be836c71f02e
|
|
BLAKE2b-256 checksum How to use checksums |
16094e96c47f5d355b186a9d9062a33bb52eb0bbb3439d23fbfc459c9c391184
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Release files / pasteconnect-0.6.2-py3-none-any.whl
| Download URL | pasteconnect-0.6.2-py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1970c2405269990b49cb466f06754ffcc80d0b8be605dff3520386caa7524519
|
|
BLAKE2b-256 checksum How to use checksums |
8bb6bca34c73a43b577963cf4e51acfe326947a41c48ddfe218b6df2161a1396
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Security for pasteconnect 0.6.2
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.