Minimalistic Python client for pastes.dev Share your code in seconds with a simple function call.
✨ Features
- 🌀 Both sync and async APIs
- ⚡ One-liner usage
- 📤 Returns instant paste URL
- 🐍 Pure Python, only requests and httpx are required
📦 Installation
pip install pastes
⚡ Usage
🔹 Sync
from pastes import paste, get_paste, _set_api_url, _set_user_agent
# set custom API endpoint (optional)
_set_api_url("https://my-api.example.com")
# set custom user agent (optional)
_set_user_agent("My project/1.0.0")
code = """
def fib(n):
a, b = 0, 1
while a < n:
print(a, end=' ')
a, b = b, a+b
print()
fib(1000)
"""
# create paste
url = paste(code)
print(url) # https://pastes.dev/UUHlliP7SF
# fetch paste
print(get_paste(url)) # def fib(n): ...
🔹 Async
from pastes import apaste, aget_paste, _set_api_url, _set_user_agent
import asyncio
# set custom API endpoint (optional)
_set_api_url("https://my-api.example.com")
# set custom user agent (optional)
_set_user_agent("My project/1.0.0")
code = """
def fib(n):
a, b = 0, 1
while a < n:
print(a, end=' ')
a, b = b, a+b
print()
fib(1000)
"""
async def main():
# create paste
url = await apaste(code)
print(url) # https://pastes.dev/UUHlliP7SF
# fetch paste
text = await aget_paste(url)
print(text) # def fib(n): ...
asyncio.run(main())
👨💻 Author
Made with ❤️ by @RimMirK
Metadata
Release files for pastes 1.5.1.post1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pastes-1.5.1.post1.tar.gz | 16.3 kB | Without provenance | Details for pastes-1.5.1.post1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pastes-1.5.1.post1-py3-none-any.whl | Python 3 | none | any | Details for pastes-1.5.1.post1-py3-none-any.whl |
Total release size: 33.0 kB
Release files / pastes-1.5.1.post1.tar.gz
| Download URL | pastes-1.5.1.post1.tar.gz |
|---|---|
| Size | 16.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a3cacd88254b63f8654d62f5e5fc46176d2c360a8c59f2c6e55ac3082a1df53a
|
|
BLAKE2b-256 checksum How to use checksums |
fd5f862013baf5e07f75d0fa19317c9d100a0bca96b683cda6853de6b428f483
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / pastes-1.5.1.post1-py3-none-any.whl
| Download URL | pastes-1.5.1.post1-py3-none-any.whl |
|---|---|
| Size | 16.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1c75d9d449224df23a4ea8d379002f12962ad594b73a1b68b075729d8b7c0314
|
|
BLAKE2b-256 checksum How to use checksums |
e42397369ccb5a64f5627b6c1939fed84ff378f87b19ebb46bc137bf610e211a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Security for pastes 1.5.1.post1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.