Skip to main content

Package to read and upload code/text to pastebin.com.

Project description

Pasteconnect package

PyPI

What can this package do ?

paste code in pastebin.com with api. Read text of pastebin paste.

Licence

Installation

Python 3.7 or higher is required. Python

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 account

after 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) Static Badge

*required for other modules to work

Username Password Api_key

Refer Getting Started

username = "heartlog"
password = "*******"
api_key = "123456abcdefg"
# Define Client
pastebin = PasteConn(username, password, api_key)

pastebin.check_account()

dash

Check validity of pastebin.com account.

result = pastebin.check_account()
print(result)  # Response: '[heartlog] is Valid Account. User key : "user_key"'

pastebin.authenticate()

dash

Get user_key using give credentials.

result = pastebin.authenticate()
print(result)  # Response: "user_key"

pastebin.create_paste(privacy, title, content)

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)

Static Badge

url = "https://pastebin.com/kZATAWhe"
result = pastebin.delete_paste(url)
print(result)  # Response: "Paste Removed"

pastebin.get_raw_content(url)

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


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)

Uploaded Source

Built Distribution

pasteconnect-0.6.1-py3-none-any.whl (5.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page