Skip to main content

This is a library for accessing pastebin easly. Also pastelib was token

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.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-py3-none-any.whl (2.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pastebinlib-1.1.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.tar.gz
Algorithm Hash digest
SHA256 652b8d0e3eead1515969a801752b84be5964b59b115983893653c540aa556b95
MD5 b76030391a3495768f9916610373a879
BLAKE2b-256 d1df78b2df520008f5dd3828cec528f57c7cde43105f7a998a2412384ab69d0e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pastebinlib-1.1-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-py3-none-any.whl
Algorithm Hash digest
SHA256 b4a0ef48ccc99a9a9d4f51a7b860f5a7e7b58da6503c8184e77b438212508418
MD5 d6a703196ef53450a076fe2a05bf59b1
BLAKE2b-256 f691293ac489c71e18dd7b3e8a993e5e005dd06d2b7b6cbbc35fb6ecb1cdda4c

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