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.
Features
- -
POST
ing to the API, which will return the provided url. - -
GET
ting from the API, provided you know the URL or paste ID. - -
DELETE
ing from the API, provided the paste is attached to your account. - -
PATCH
ing 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)
#NOTE: The `api_key` kwarg in the Client constructor is optional.
paste = mystbin_client.post("Hello from sync Mystb.in!", syntax="text")
str(paste)
>>> 'https://mystb.in/<your generated ID>.text'
NOTE: 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.2.0.tar.gz
(8.2 kB
view details)
Built Distribution
File details
Details for the file mystbin.py-2.2.0.tar.gz
.
File metadata
- Download URL: mystbin.py-2.2.0.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.11 CPython/3.9.6 Linux/4.19.0-17-amd64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6c17af2bcca5b5d36670f56785f813aec0b80a95cc741fb44c8991d97919b9a |
|
MD5 | 09e306beee14fbbe5f1274e2d353d854 |
|
BLAKE2b-256 | 8ffb75ef625d40c3b904120aa0613a92b4ea7d79b8a4038d99e9d80ca406ed39 |
File details
Details for the file mystbin.py-2.2.0-py3-none-any.whl
.
File metadata
- Download URL: mystbin.py-2.2.0-py3-none-any.whl
- Upload date:
- Size: 12.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.11 CPython/3.9.6 Linux/4.19.0-17-amd64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff405f74426203c56998e328b663e5452d5b81ec47a03ea929b5343446bfd640 |
|
MD5 | df2f7fc90b35e2fb518b4c71f90380f0 |
|
BLAKE2b-256 | 6cf89d38f30663bfff06c808844e6146c3ca6cfa2f7aa1d80331486b0f285f75 |