Package to read and upload code/text to pastebin.com.
Project description
Pasteconnect package
What can this package do ?
paste code in pastebin.com with api. Read text of pastebin paste.
Installation
Python 3.7 or higher is required.
Install from PyPI
$ pip install pasteconnect
Install from source
$ pip install git+https://github.com/heartlog/pasteconnect
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_key
under Your Unique Developer API Key
Usage example
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)
privacy = 0 # Set the privacy level (0 for public)
title = "My Paste Title"
content = "This is the content of my paste."
# Paste text to pastebin
paste_url = pastebin.create_paste(privacy, title, content)
print(f"Paste created: {paste_url}")
pastebin = PasteConn(username, password, api_key)
*required for other modules to work
Refer Getting Started
username = "heartlog"
password = "*******"
api_key = "123456abcdefg"
# Define Client
pastebin = PasteConn(username, password, api_key)
pastebin.check_account()
Check validity of pastebin.com account.
result = pastebin.check_account()
print(result) # Response: '[heartlog] is Valid Account. User key : "user_key"'
pastebin.authenticate()
Get user_key using give credentials.
result = pastebin.authenticate()
print(result) # Response: "user_key"
pastebin.create_paste(privacy, title, content)
# 0 : public | 1 : unlisted | 2 : private
privacy = 1
title = "Title of paste"
content = """
Hello
This is multiline text
"""
pastebin.create_paste(privacy, title, content)
pastebin.delete_paste(url)
url = "https://pastebin.com/kZATAWhe"
result = pastebin.delete_paste(url)
print(result) # Response: "Paste Removed"
pastebin.get_raw_content(url)
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. 😁
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pasteconnect-0.6.1.tar.gz
(4.7 kB
view hashes)
Built Distribution
Close
Hashes for pasteconnect-0.6.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dfe33759e537e4946bf30b5343c6f3cf5e1391d77ba6db10af1e9516a7c4a4d7 |
|
MD5 | 778b75162a0bb3b6628b5172f92e8d28 |
|
BLAKE2b-256 | 61ce0e1ed10793a3e5c6b41f4032d32cca9bb6d6843941726d89e9a55623f0c2 |