Skip to main content

pyNekobin - A Wrapper for Nekobin API

This is a Python package that provides a simple wrapper around the Nekobin API, allowing you to easily paste and retrieve text snippets from the popular pastebin service.

MIT LICENSE Supported Python Versions Pylint Test PyPy Version Code Quality

Installation

You can install the package from pypy using pip:

pip install -U pynekobin

Documentation

Documentation of this package can be found at nusab19.github.io/pyNekobin

The content of the docs website is the same as this README file. :3

Usage

This package is asynchronous and uses httpx under the hood to make HTTP requests. So, you need to use the await keyword with each method call. First, import the Nekobin class and the asyncio library:

from nekobin import Nekobin
import asyncio

Then, create an instance of the Nekobin class:

nb = Nekobin()

To paste text to Nekobin, you can use the paste() method:

async def main():
    result = await nb.paste("Hello, world!")
    
    if result.ok:
        print("Pasted text at:", result.url) # -> Pasted text at: https://nekobin.com/abxajsyas
    else:
        print("Error:",  result.message)     # Error: Nekobin did not fulfil the request

asyncio.run(main())

Similarly, you can use the read() method to retrieve text from Nekobin:

async def main():
    result = await nb.read("https://nekobin.com/abxajsyas")
    
    if result.ok:
        print("Retrieved text:", result.content) # -> Retrieved text: Hello, world!
    else:
        print("Error:", result.message)          # -> Error: Document not found 

asyncio.run(main())

Advanced Usage

As this package uses httpx under the hood, you can pass additional keyword arguments in each method call. You can pass any keyword argument that httpx.AsyncClient may take:

from nekobin import Nekobin
import asyncio

nb = Nekobin(timeout=10, headers={}, follow_redirects=True)

If you want to pass these arguments in each method call, you have that too:

from nekobin import Nekobin
import asyncio

nb = Nekobin()

async def main():
    result = await nb.paste("Hello, world!", timeout=10)
    url = result.url
    print("Pasted at:", url)

    content = (await nb.read(url, timeout=7)).content
    print("Content:", content)

asyncio.run(main())

Contributing

If you encounter any bugs or issues, please feel free to open an issue on the GitHub repository. If you would like to contribute to the development of the package, you can fork the repository and submit a pull request with your changes.

To use this package locally:

git clone https://github.com/Nusab19/pyNekobin
cd pyNekobin
pip install -e .

License

This package is licensed under the MIT License. See the LICENSE file for more information.

Made with ❤ by Nusab Taha from the Universe!

Release files for pyNekobin 3.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyNekobin 3.1.1
File Size Uploaded
pynekobin-3.1.1.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyNekobin 3.1.1
File Interpreter ABI Platform
pynekobin-3.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.1 kB

Release files / pynekobin-3.1.1.tar.gz

Download URL pynekobin-3.1.1.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
84ef724f0199a0c26f678a1fc655e5661f8ef6b4e1aaf80e4bc04af3b8249841
BLAKE2b-256 checksum
How to use checksums
8e2521c62b5a7c9ac404ba50c55990beffcd7d4881b68c73ae888723bd8f6493
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Release files / pynekobin-3.1.1-py3-none-any.whl

Download URL pynekobin-3.1.1-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3a21de7dfec8b94f71bb04f91fb20053fe7ac3fb0e0371514dc5821634564629
BLAKE2b-256 checksum
How to use checksums
e988a20d585cb0be1ce0b29fcbcbc6c9e3f94ec14858ea4ea38ae17178312000
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Release history Release notifications | RSS feed

This release

3.1.1 This release

2 release files

3.1

2 release files

3.0

1 release file

2.9

1 release file

2.8

1 release file

2.7

2 release files

2.5

2 release files

2.4

2 release files

2.3

2 release files

2.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page