Skip to main content

Paste anywhere!

Project description

SuperPaste

Have you ever found yourself in code, needing to send a large chunk of text, such as a log file, but didn't want to clog up the chat with a wall of text? SuperPaste is here to help! SuperPaste is a simple, easy-to-use tool that allows you to paste large chunks of text into a file, and then send a link to that file to your friends or coworkers. They can then view the file in their browser, without having to download it.

This works by taking your desired files, such as a log string, and posting them to a chosen server, such as hst.sh and mystb.in. The server will then return a link to the file, which you can then send to your friends.


This is a continuation of the PostBin project, which was discontinued as it fell into disrepair, and had an ugly API.

Installing:

You can install from git:

pip install git+https://github.com/nexy7574/superpaste.git

Usage:

you can use it in your code like so:

>>> from superpaste.backends import HstSHBackend, BasePasteResult
# See: /src/superpaste/backends/__init__.py for more backends


# Create a backend
>>> backend = HstSHBackend()

# Post a file
>>> result = backend.create_paste(backend.file_class.from_file("path/to/file.txt"))
>>> print(result.url)
BasePasteResult(url='https://hst.sh/2', key="2")

# Post a string
>>> result = backend.create_paste(backend.file_class("content here"))
>>> print(result.url)
BasePasteResult(url='https://hst.sh/2', key="2")

# You can also post bytes, assuming they're actually just UTF-8 text.
r>>> esult = backend.create_paste(backend.file_class(b"bytes here"))
>>> print(result.url)
BasePasteResult(url='https://hst.sh/3', key="3")

# You can post multiple files, too
>>> results = backend.create_paste(
    backend.file_class("content here"),
    backend.file_class.from_file("path/to/file.txt"),
)
[
    BasePasteResult(url='https://hst.sh/4', key="4"),
    BasePasteResult(url='https://hst.sh/5', key="5"),
]

# There is also an async API, which just wraps the sync API in an async function, pushing it to a thread:
# To use this part of the example, you either need to be in an async function, or use iPython.
>>> await backend..async_create_paste(backend.file_class("content here"))
BasePasteResult(url='https://hst.sh/6', key="6")

or use it in your console:

$ superpaste --backend mystb.in path/to/file.txt
...
$ echo "content here" | superpaste --backend hst.sh -
...
$ superpaste --backend hst.sh path/to/file1.txt path/to/another/file1.txt
file file1.txt: https://hst.sh/2
file file2.txt: https://hst.sh/3

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

superpaste-1.0.0rc2.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

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

superpaste-1.0.0rc2-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file superpaste-1.0.0rc2.tar.gz.

File metadata

  • Download URL: superpaste-1.0.0rc2.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.4

File hashes

Hashes for superpaste-1.0.0rc2.tar.gz
Algorithm Hash digest
SHA256 7286ba0564cd43e36a5735d3b0586058453a8fcf18e06d87143758093e0dd21d
MD5 eadd96470d0d84a03f38f940aede1aff
BLAKE2b-256 3feec5e3b80d6831fd64eab91a549cd39c103c87f9a55db17e9abc1d41b7a413

See more details on using hashes here.

File details

Details for the file superpaste-1.0.0rc2-py3-none-any.whl.

File metadata

  • Download URL: superpaste-1.0.0rc2-py3-none-any.whl
  • Upload date:
  • Size: 15.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.4

File hashes

Hashes for superpaste-1.0.0rc2-py3-none-any.whl
Algorithm Hash digest
SHA256 290ca3c9be7e8a47a744eacb30cb42fa0b342cae3c695fa146f2c094298bd5ce
MD5 fadb383f401c3bfcd83bec2f1b427e69
BLAKE2b-256 3ec3b3fbd0276f1ae62dc7ade9dc275e77646ea812785bcf385eeb64499c5d6a

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