You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+46-4Lines changed: 46 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,13 +5,55 @@ A small simple wrapper around the [Mystb.in](https://mystb.in/) API.
5
5
### Features
6
6
7
7
[x] - `POST`ing to the API, which will return the provided url. \
8
-
[x] - `GET`ting from the API, provided you know the URL or paste ID. \
9
-
[] - Ability to pass in a sync or async session / parameter so it is flexible.
8
+
[] - `GET`ting from the API, provided you know the URL or paste ID. \
9
+
[x] - Ability to pass in a sync or async session / parameter so it is flexible.
10
10
11
-
[] - Write a real underlying Client for this, it will be required for... \
11
+
[x] - Write a real underlying Client for this, it will be required for... \
12
12
[] - Authorization. Awaiting the API making this public as it is still WIP. \
13
13
14
+
### Installation
15
+
This project will be on [PyPI](https://pypi.org/project/mystbin.py/) as a stable release, you can always find that there.
16
+
17
+
Installing via `pip`:
18
+
```shell
19
+
python -m pip install -U mystbin.py
20
+
# or for optional sync addon...
21
+
python -m pip install -U mystbin.py[requests]
22
+
```
23
+
24
+
Installing from source:
25
+
```shell
26
+
python -m pip install git+https://github.com/AbstractUmbra/mystbin-py.git #[requests] for sync addon
27
+
```
28
+
29
+
### Usage examples
30
+
Since the project is considered multi-sync, it will work in a sync/async environment, see the optional dependency of `requests` below.
31
+
32
+
```py
33
+
# async example - it will default to async
34
+
import mystbin
35
+
36
+
mystbin_client = mystbin.MystClient() ## api_key kwarg for authentication also
37
+
38
+
await mystbin_client.post("Hello from Mystb.in!", suffix="python")
39
+
>>>'https://mystb.in/<your generated ID>.python'
40
+
```
41
+
42
+
```py
43
+
# sync example - we need to pass a session though
44
+
import mystbin
45
+
import requests
46
+
47
+
sync_session = requests.Session()
48
+
mystbin_client = mystbin.MystClient(session=sync_session) ## optional api_key kwarg also
49
+
50
+
mystbin_client.post("Hello from sync Mystb.in!", suffix="text")
51
+
>>>'https://mystb.in/<your generated ID>.text'
52
+
```
53
+
54
+
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.
0 commit comments