SheriAPI


NameSheriAPI JSON
Version 1.0.4 PyPI version JSON
download
home_pagehttps://github.com/Nanofaux/SheriAPI
SummaryA simple API wrapper to interact with the Sheri Blossom API.
upload_time2024-01-10 22:27:25
maintainer
docs_urlNone
authorNanofaux
requires_python>=3.6
licenseMIT
keywords furry sheriapi sheri blossom yiff fur discord
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            A simple API wrapper for Sheri Blossom (https://sheri.bot/)

The API provides several endpoints for free however some will require a unique token.

You can obtain your token by going to the dashboard (https://sheri.bot/settings/) and scrolling to the bottom.

Examples:

```python
from SheriAPI import SheriAPI

api = SheriAPI(token="Your Token Here")

res = await api.get('hug')

# Get the image URL
url = res.url
# Or the report URL
report_url = res.report_url

# Save the image to disk
await res.save('/')
```
You can also use it in a context manager if you like:
```python
from SheriAPI import SheriAPI

async with SheriAPI(token="Your Token Here") as api:
    img = await api.get('fox')
    img2 = await api.get('cat')
    await img.save('/foxes')
    await img2.save('/cats')
```
Additionally, there are enums of which list all applicable API endpoints. 
You may use them as well.
```python
from SheriAPI import SheriAPI, FreeEndpoint

async with SheriAPI() as api:
    img = await api.get(FreeEndpoint.Fox)
    await img.save('/foxes')
```
You can specify an amount of images to return from the API.
If it is any amount other than 1, it will be a list of SheriResponse objects.

```python
from SheriAPI import SheriAPI, FreeEndpoint

async with SheriAPI() as api:
    imgs = await api.get(
        FreeEndpoint.Fox,
        count=10
    )
    for img in imgs:
        await img.save(f"images/{img.image_hash}")
```
The only time a token is *needed* is when attempting to use an endpoint that is not free.
For example:
```python
from SheriAPI import SheriAPI, SFWEndpoint

# Works
async with SheriAPI(token="Your Token Here") as api:
    img = await api.get(SFWEndpoint.Paws)
    print(img.url)

# Raises an InvalidToken exception
async with SheriAPI() as api:
    img = await api.get(SFWEndpoint.Paws)
    print(img.url)
```

Lastly, in order to use NSFW endpoints, you must pass in `allow_nsfw=True`.
```python
from SheriAPI import SheriAPI, NSFWEndpoint

# Works
async with SheriAPI(
        token="Your Token Here",
        allow_nsfw=True
) as api:
    img = await api.get(NSFWEndpoint.Gay)
    print(img.url)

# Raises NSFWEndpointWithoutAllowNSFW exception
async with SheriAPI(token="Your Token Here") as api:
    img = await api.get(NSFWEndpoint.Dick_Wank)
    print(img.url)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Nanofaux/SheriAPI",
    "name": "SheriAPI",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "furry,SheriAPI,sheri blossom,yiff,fur,discord",
    "author": "Nanofaux",
    "author_email": "nanofaux@hotmail.com",
    "download_url": "https://files.pythonhosted.org/packages/a9/c8/d453a456c4381a24944fc6eeb62bd9ddccae9323d27ee3139656b4584f92/SheriAPI-1.0.4.tar.gz",
    "platform": null,
    "description": "A simple API wrapper for Sheri Blossom (https://sheri.bot/)\r\n\r\nThe API provides several endpoints for free however some will require a unique token.\r\n\r\nYou can obtain your token by going to the dashboard (https://sheri.bot/settings/) and scrolling to the bottom.\r\n\r\nExamples:\r\n\r\n```python\r\nfrom SheriAPI import SheriAPI\r\n\r\napi = SheriAPI(token=\"Your Token Here\")\r\n\r\nres = await api.get('hug')\r\n\r\n# Get the image URL\r\nurl = res.url\r\n# Or the report URL\r\nreport_url = res.report_url\r\n\r\n# Save the image to disk\r\nawait res.save('/')\r\n```\r\nYou can also use it in a context manager if you like:\r\n```python\r\nfrom SheriAPI import SheriAPI\r\n\r\nasync with SheriAPI(token=\"Your Token Here\") as api:\r\n    img = await api.get('fox')\r\n    img2 = await api.get('cat')\r\n    await img.save('/foxes')\r\n    await img2.save('/cats')\r\n```\r\nAdditionally, there are enums of which list all applicable API endpoints. \r\nYou may use them as well.\r\n```python\r\nfrom SheriAPI import SheriAPI, FreeEndpoint\r\n\r\nasync with SheriAPI() as api:\r\n    img = await api.get(FreeEndpoint.Fox)\r\n    await img.save('/foxes')\r\n```\r\nYou can specify an amount of images to return from the API.\r\nIf it is any amount other than 1, it will be a list of SheriResponse objects.\r\n\r\n```python\r\nfrom SheriAPI import SheriAPI, FreeEndpoint\r\n\r\nasync with SheriAPI() as api:\r\n    imgs = await api.get(\r\n        FreeEndpoint.Fox,\r\n        count=10\r\n    )\r\n    for img in imgs:\r\n        await img.save(f\"images/{img.image_hash}\")\r\n```\r\nThe only time a token is *needed* is when attempting to use an endpoint that is not free.\r\nFor example:\r\n```python\r\nfrom SheriAPI import SheriAPI, SFWEndpoint\r\n\r\n# Works\r\nasync with SheriAPI(token=\"Your Token Here\") as api:\r\n    img = await api.get(SFWEndpoint.Paws)\r\n    print(img.url)\r\n\r\n# Raises an InvalidToken exception\r\nasync with SheriAPI() as api:\r\n    img = await api.get(SFWEndpoint.Paws)\r\n    print(img.url)\r\n```\r\n\r\nLastly, in order to use NSFW endpoints, you must pass in `allow_nsfw=True`.\r\n```python\r\nfrom SheriAPI import SheriAPI, NSFWEndpoint\r\n\r\n# Works\r\nasync with SheriAPI(\r\n        token=\"Your Token Here\",\r\n        allow_nsfw=True\r\n) as api:\r\n    img = await api.get(NSFWEndpoint.Gay)\r\n    print(img.url)\r\n\r\n# Raises NSFWEndpointWithoutAllowNSFW exception\r\nasync with SheriAPI(token=\"Your Token Here\") as api:\r\n    img = await api.get(NSFWEndpoint.Dick_Wank)\r\n    print(img.url)\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A simple API wrapper to interact with the Sheri Blossom API.",
    "version": "1.0.4",
    "project_urls": {
        "Homepage": "https://github.com/Nanofaux/SheriAPI"
    },
    "split_keywords": [
        "furry",
        "sheriapi",
        "sheri blossom",
        "yiff",
        "fur",
        "discord"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cbef2915ce3e6ec46f871c6d9e5ac875106151ce173734fd34d7588651b9d551",
                "md5": "87b63a4dd222bbbb8c827e9823a9f0a1",
                "sha256": "fa6dd9ebd2bc22b4efc3e21990951b4143ad19310e99907cc2b6e550460e10f6"
            },
            "downloads": -1,
            "filename": "SheriAPI-1.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "87b63a4dd222bbbb8c827e9823a9f0a1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 12274,
            "upload_time": "2024-01-10T22:27:23",
            "upload_time_iso_8601": "2024-01-10T22:27:23.485009Z",
            "url": "https://files.pythonhosted.org/packages/cb/ef/2915ce3e6ec46f871c6d9e5ac875106151ce173734fd34d7588651b9d551/SheriAPI-1.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a9c8d453a456c4381a24944fc6eeb62bd9ddccae9323d27ee3139656b4584f92",
                "md5": "9d795d5d4a72b06fcfba716c0016b149",
                "sha256": "dd89e8e45f5912848903231ecc9dc2212b9545f123a95fee1299bd447600b7dd"
            },
            "downloads": -1,
            "filename": "SheriAPI-1.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "9d795d5d4a72b06fcfba716c0016b149",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 4180237,
            "upload_time": "2024-01-10T22:27:25",
            "upload_time_iso_8601": "2024-01-10T22:27:25.523465Z",
            "url": "https://files.pythonhosted.org/packages/a9/c8/d453a456c4381a24944fc6eeb62bd9ddccae9323d27ee3139656b4584f92/SheriAPI-1.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-10 22:27:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Nanofaux",
    "github_project": "SheriAPI",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "sheriapi"
}
        
Elapsed time: 0.19978s