Skip to content

Commit 0f66fb3

Browse files
committed
Update README for new usage and guild invite
1 parent 1ac41dc commit 0f66fb3

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

README.md

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</div>
1313
<br>
1414

15-
A small simple wrapper around the [MystB.in](https://mystb.in/) API.
15+
A small simple wrapper around the [Mystb.in](https://mystb.in/) API.
1616
API docs can be found [here](https://api.mystb.in/docs).
1717
----------
1818
### Features
@@ -49,29 +49,37 @@ import mystbin
4949

5050
mystbin_client = mystbin.Client()
5151

52-
paste = await mystbin_client.post("Hello from MystBin!", syntax="python")
52+
paste = await client.create_paste(filename="Hello.txt", content="Hello there!", syntax="txt")
5353
str(paste)
54-
>>> 'https://mystb.in/<your generated ID>.python'
54+
>>> 'https://mystb.in/<your generated ID>'
5555

56-
paste.url
57-
>>> 'https://mystb.in/<your generated ID>.python'
56+
get_paste = await mystbin_client.get_paste("<your generated ID>")
57+
get_paste.files[0].content
58+
>>> "Hello there!"
5859

59-
get_paste = await mystbin_client.get("https://mystb.in/<your generated ID>")
60-
str(get_paste)
61-
>>> "Hello from MystBin!"
62-
63-
paste.created_at
60+
get_paste.created_at
6461
>>> datetime.datetime(2020, 10, 6, 10, 53, 57, 556741)
6562
```
6663

64+
Or if you want to create a paste with multiple files...
6765
```py
6866
import mystbin
6967

70-
mystbin_client = mystbin.SyncClient()
68+
file = mystbin.File(filename="File1.txt", content="Hello there!", syntax="txt")
69+
file2 = mystbin.File(filename="test.py", content="print('hello!')", syntax="py")
7170

72-
paste = mystbin_client.post("Hello from sync Mystb.in!", syntax="text")
73-
str(paste)
74-
>>> 'https://mystb.in/<your generated ID>.text'
71+
paste = await client.create_multifile_paste(files=[file, file2])
72+
73+
for file in paste.files:
74+
print(file.content)
75+
76+
>>> "Hello there!"
77+
>>> "print('hello!')"
7578
```
7679

77-
NOTE: There is a timeout of 15s for each operation.
80+
If you have any question please feel free to join the Pythonista Discord server:
81+
<div align="left">
82+
<a href="https://discord.gg/RAKc3HF">
83+
<img src="https://discordapp.com/api/guilds/490948346773635102/widget.png?style=banner2" alt="Discord Server"/>
84+
</a>
85+
</div>

0 commit comments

Comments
 (0)