# pyNekobin - A Wrapper for Nekobin API
<p align="center">
<img height="300px" src="https://graph.org/file/3d18ed58543a0379b241c.jpg">
</p>
This is a Python package that provides a simple wrapper around the [Nekobin](https://nekobin.com/) API, allowing you to easily paste and retrieve text snippets from the popular pastebin service.
[](#) [](#)
[](https://github.com/Nusab19/pyNekobin/actions/workflows/pylint_test.yml)
[](#)

## Installation
You can install the package from [pypy](https://pypi.org/project/pyNekobin/) using pip:
```
pip install -U pynekobin
```
## Documentation
Documentation of this package can be found at <a href="https://nusab19.github.io/pyNekobin">nusab19.github.io/pyNekobin</a>
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:
```python
from nekobin import Nekobin
import asyncio
```
Then, create an instance of the `Nekobin` class:
```python
nb = Nekobin()
```
To paste text to Nekobin, you can use the `paste()` method:
```python
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:
```python
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:
```python
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:
```python
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](https://github.com/Nusab19/pyNekobin/pulls). 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:
```bash
git clone https://github.com/Nusab19/pyNekobin
cd pyNekobin
pip install -U httpx
pip install -e .
```
## License
This package is licensed under the MIT License. See the `LICENSE` file for more information.
**Made with ❤ by [Nusab Taha](https://github.com/Nusab19) from the Universe!**
Raw data
{
"_id": null,
"home_page": "https://github.com/Nusab19/pyNekobin",
"name": "pyNekobin",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "Nekobin,pyNekobin,Paste Code,Paste Bin",
"author": "Nusab Taha",
"author_email": "nusabtaha33@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/2c/64/f3f540106f21c1c06a86bc162424a2931d6c56f8519625ee39fc5d1f79fa/pyNekobin-3.1.tar.gz",
"platform": null,
"description": "# pyNekobin - A Wrapper for Nekobin API\n<p align=\"center\">\n<img height=\"300px\" src=\"https://graph.org/file/3d18ed58543a0379b241c.jpg\">\n</p>\n\nThis is a Python package that provides a simple wrapper around the [Nekobin](https://nekobin.com/) API, allowing you to easily paste and retrieve text snippets from the popular pastebin service.\n\n[](#) [](#)\n[](https://github.com/Nusab19/pyNekobin/actions/workflows/pylint_test.yml)\n[](#)\n\n\n## Installation\n\nYou can install the package from [pypy](https://pypi.org/project/pyNekobin/) using pip:\n\n```\npip install -U pynekobin\n```\n\n## Documentation\nDocumentation of this package can be found at <a href=\"https://nusab19.github.io/pyNekobin\">nusab19.github.io/pyNekobin</a>\n\nThe content of the docs website is the same as this README file. :3\n\n## Usage\n\nThis 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.\nFirst, import the `Nekobin` class and the `asyncio` library:\n\n```python\nfrom nekobin import Nekobin\nimport asyncio\n```\n\nThen, create an instance of the `Nekobin` class:\n\n```python\nnb = Nekobin()\n```\n\nTo paste text to Nekobin, you can use the `paste()` method:\n\n```python\nasync def main():\n result = await nb.paste(\"Hello, world!\")\n \n if result.ok:\n print(\"Pasted text at:\", result.url) # -> Pasted text at: https://nekobin.com/abxajsyas\n else:\n print(\"Error:\", result.message) # Error: Nekobin did not fulfil the request\n\nasyncio.run(main())\n```\n\nSimilarly, you can use the `read()` method to retrieve text from Nekobin:\n\n```python\nasync def main():\n result = await nb.read(\"https://nekobin.com/abxajsyas\")\n \n if result.ok:\n print(\"Retrieved text:\", result.content) # -> Retrieved text: Hello, world!\n else:\n print(\"Error:\", result.message) # -> Error: Document not found \n\nasyncio.run(main())\n```\n\n## Advanced Usage\n\nAs 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:\n\n```python\nfrom nekobin import Nekobin\nimport asyncio\n\nnb = Nekobin(timeout=10, headers={}, follow_redirects=True)\n```\n\nIf you want to pass these arguments in each method call, you have that too:\n\n```python\nfrom nekobin import Nekobin\nimport asyncio\n\nnb = Nekobin()\n\nasync def main():\n result = await nb.paste(\"Hello, world!\", timeout=10)\n url = result.url\n print(\"Pasted at:\", url)\n\n content = (await nb.read(url, timeout=7)).content\n print(\"Content:\", content)\n\nasyncio.run(main())\n```\n\n## Contributing\n\nIf you encounter any bugs or issues, please feel free to open an issue on the [GitHub repository](https://github.com/Nusab19/pyNekobin/pulls). 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.\n\nTo use this package locally:\n```bash\ngit clone https://github.com/Nusab19/pyNekobin\ncd pyNekobin\npip install -U httpx\npip install -e .\n```\n\n\n## License\n\nThis package is licensed under the MIT License. See the `LICENSE` file for more information.\n\n\n\n**Made with \u2764 by [Nusab Taha](https://github.com/Nusab19) from the Universe!**\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Paste codes to Nekobin.com with python",
"version": "3.1",
"project_urls": {
"Download": "https://github.com/Nusab19/pyNekobin/releases/tag/pyNekobin-3.1",
"Homepage": "https://github.com/Nusab19/pyNekobin"
},
"split_keywords": [
"nekobin",
"pynekobin",
"paste code",
"paste bin"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c14c4f92cc28e685fd74126a9732d55ecfa98a30d13c707f933509054e14676b",
"md5": "78c6729c3e9448cfe8f73e5fc8e3947d",
"sha256": "153c654828db160a6305fc701c5e37f8051b2074a35d2aece4ced44dd0c0790c"
},
"downloads": -1,
"filename": "pyNekobin-3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "78c6729c3e9448cfe8f73e5fc8e3947d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 5034,
"upload_time": "2023-08-16T09:23:32",
"upload_time_iso_8601": "2023-08-16T09:23:32.309361Z",
"url": "https://files.pythonhosted.org/packages/c1/4c/4f92cc28e685fd74126a9732d55ecfa98a30d13c707f933509054e14676b/pyNekobin-3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2c64f3f540106f21c1c06a86bc162424a2931d6c56f8519625ee39fc5d1f79fa",
"md5": "8ec843aaed0da06801ff5146dadb3d78",
"sha256": "dcafc576430037e90310a3ddf0788ad351017378a3e4019808903780a205ef89"
},
"downloads": -1,
"filename": "pyNekobin-3.1.tar.gz",
"has_sig": false,
"md5_digest": "8ec843aaed0da06801ff5146dadb3d78",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4881,
"upload_time": "2023-08-16T09:23:33",
"upload_time_iso_8601": "2023-08-16T09:23:33.302535Z",
"url": "https://files.pythonhosted.org/packages/2c/64/f3f540106f21c1c06a86bc162424a2931d6c56f8519625ee39fc5d1f79fa/pyNekobin-3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-16 09:23:33",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Nusab19",
"github_project": "pyNekobin",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pynekobin"
}