Skip to main content

This is a library for accessing pastebin easily. Also pastelib was already taken

Project description

Pastebinlib

By TheDiamondOG Source Code: https://github.com/thediamondog/pastebinlib

A small python library made for interacting with Pastebin

Story

This was one of those small projects I would just make while I am in class, normally I would just make a multi tool, but this time I wanted to add in Pastebin support which is why I made Pastebinlib. It was meant to be for that small project on Replit, but I thought this is a pretty useful tool, so I wanted to make it public on GitHub.

This was originally made on November 13, 2023. The thing is that I forgot to upload it for 4 days so the whole thing released on GitHub on November 13, 2023.

8 months later I got bored and wanted to upgrade the project, so after releasing fake terminal I worked on this. So now Pastebinlib is now better, and I actually know how to get something on PyPi.


Install

Source

This is only if you want to run it straight from source

git clone https://github.com/TheDiamondOG/pastebinlib
python setup.py install

PyPi (Not out yet)

This is from PyPi the best way to get it

pip install pastebinlib

Documentation

Normal Pastebin API

Requirements \

Setting up the library to use the API wrapper

import pastebinlib

pastebin = pastebinlib.Pastebinlib(api_key)

This is how you create a paste in Pastebinlib

Requirements

  • Text
  • Paste Name
  • Privacy
  • Paste Format
  • Expiring Time

Privacy Option

  • public
  • unlisted
  • private

Expire options

  • never
  • 10 minutes
  • 1 hour
  • 1 day
  • 1 week
  • 2 weeks
  • 1 month
  • 6 months
  • 1 year
import pastebinlib

pastebin = pastebinlib.Pastebinlib(api_key)

"""
First is the text
Second is the name
Third is the privacy
Fourth is the paste format
Last is the expiring time
"""

pastebin.create_paste("Your Text", "Your Paste Name", "public", "text", "never")

This is how to get the data from a paste

Requirements

  • URL/Paste ID
  • JSON <True/False>
import pastebinlib

pastebin = pastebinlib.Pastebinlib(api_key)

"""
First is the URL/Paste ID
Second is using to say if the paste is in the json format <True/False>
"""

pastebin.get_paste("https://pastebin.com/raw/Fj8dsgCR", False)

This is how to get the id of a paste for some reason

All you need is the URL

import pastebinlib

pastebin = pastebinlib.Pastebinlib(api_key)

"""
Input the url
"""

pastebin.get_paste_id("https://pastebin.com/raw/Fj8dsgCR")

User Pastebin API

Setting up the the class for the User Pastebinlib

Requirements for this one

import pastebinlib

userbin = pastebinlib.User(api_key, user_key, username, password)

This is how to list pastes under the account returns a list Optional

  • Limits (50 is default)
import pastebinlib

userbin = pastebinlib.User(api_key, user_key, username, password)

pastes = userbin.list_pastes(limit=50)

This is how you delete a paste

Requirements

  • URL/Paste
import pastebinlib

userbin = pastebinlib.User(api_key, user_key, username, password)

userbin.delete_paste(url)

Get the user info return your user info in a JSON format

import pastebinlib

userbin = pastebinlib.User(api_key, user_key, username, password)

userbin.get_user_info()

This is how to get the data from a private paste

Requirements

  • URL/Paste ID
  • JSON <True/False>
import pastebinlib

pastebin = pastebinlib.Pastebinlib(api_key)

"""
First is the URL/Paste ID
Second is using to say if the paste is in the json format <True/False>
"""

pastebin.get_paste("https://pastebin.com/raw/Fj8dsgCR", False)

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

pastebinlib-1.1.3.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pastebinlib-1.1.3-py3-none-any.whl (2.3 kB view details)

Uploaded Python 3

File details

Details for the file pastebinlib-1.1.3.tar.gz.

File metadata

  • Download URL: pastebinlib-1.1.3.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for pastebinlib-1.1.3.tar.gz
Algorithm Hash digest
SHA256 5b3c7340c92480f7e4e1f74a3683e1ed93bc2894cbb1c46eeba16f6caa985357
MD5 6888cb100734a163ceb411d0e7f212ad
BLAKE2b-256 347f9b1907b1985bf0aa2d441ef97648dde837d6a46ba5d03957108034a803df

See more details on using hashes here.

File details

Details for the file pastebinlib-1.1.3-py3-none-any.whl.

File metadata

  • Download URL: pastebinlib-1.1.3-py3-none-any.whl
  • Upload date:
  • Size: 2.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for pastebinlib-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 10e6b7f6a0a5107f95b71b650e0c6037e1050a4d804401ec3eeadffbbac6a41d
MD5 517e566ec65017006c84ec70f66a7745
BLAKE2b-256 98a38e691c68dac992e973f2e12a0753b31cbd6ee21df6b46c0abd292f42f27d

See more details on using hashes here.

Supported by

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