Skip to main content

A small simple wrapper around the mystb.in API.

Reason this release was yanked:

Outdated and no longer works.

Project description

MystBin.py!

A small simple wrapper around the MystB.in API.


Code Linting Code Analysis Build

Features

  • - POSTing to the API, which will return the provided url.
  • - GETting from the API, provided you know the URL or paste ID.
  • - DELETEing from the API, provided the paste is attached to your account.
  • - PATCHing to the API, provided the paste is attached to your account.
  • - Ability to pass in a sync or async session / parameter so it is flexible.
  • - Write a real underlying Client for this, it will be required for...
  • - ... Authorization. Awaiting the API making this public as it is still WIP.

Installation

This project will be on PyPI as a stable release, you can always find that there.

Installing via pip:

python -m pip install -U mystbin.py
# or for optional sync addon...
python -m pip install -U mystbin.py[requests]

Installing from source:

python -m pip install git+https://github.com/AbstractUmbra/mystbin-py.git #[requests] for sync addon

Usage examples

Since the project is considered multi-sync, it will work in a sync/async environment, see the optional dependency of requests below.

# async example - it will default to async
import mystbin

mystbin_client = mystbin.Client()
#NOTE: The `api_key` kwarg in the Client constructor is optional.

paste = await mystbin_client.post("Hello from MystBin!", syntax="python")
str(paste)
>>> 'https://mystb.in/<your generated ID>.python'

paste.url
>>> 'https://mystb.in/<your generated ID>.python'

get_paste = await mystbin_client.get("https://mystb.in/<your generated ID>")
str(get_paste)
>>> "Hello from MystBin!"

paste.created_at
>>> datetime.datetime(2020, 10, 6, 10, 53, 57, 556741)
# sync example - we need to pass a session though
import mystbin
import requests

sync_session = requests.Session()
mystbin_client = mystbin.Client(session=sync_session) ## optional api_key kwarg also

paste = mystbin_client.post("Hello from sync Mystb.in!", syntax="text")
str(paste)
>>> 'https://mystb.in/<your generated ID>.text'

NOTE: the session - aiohttp or requests - will have their default headers changed during init to support the Authorization header with the api key if present, and there is a timeout of 15s for each operation.

Dependencies

aiohttp - required
requests - optional

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

mystbin.py-2.1.2.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

mystbin.py-2.1.2-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file mystbin.py-2.1.2.tar.gz.

File metadata

  • Download URL: mystbin.py-2.1.2.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.4 Linux/4.19.0-13-amd64

File hashes

Hashes for mystbin.py-2.1.2.tar.gz
Algorithm Hash digest
SHA256 57e7a11583d36996defac1075500568a4fbf3112ad9468305bc9296a04ad574f
MD5 da65279f5bd50b2082a6b0091335fd60
BLAKE2b-256 3ec2507c196a9099bba96ad3983ed6a55b5533e8f1250b4fdf3edef412122be3

See more details on using hashes here.

File details

Details for the file mystbin.py-2.1.2-py3-none-any.whl.

File metadata

  • Download URL: mystbin.py-2.1.2-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.4 Linux/4.19.0-13-amd64

File hashes

Hashes for mystbin.py-2.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 faec1be009c42e64c47d5b913402378bee5109d6d8c4ebe1302be1420421fd8f
MD5 a9de6270be5eb4ad6d1b54bcc7561ec2
BLAKE2b-256 83f2e83783e7766d2fb3d5e3e60d949459701aac3af92c5f43229574516fb1d5

See more details on using hashes here.

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