aiornot


Nameaiornot JSON
Version 0.0.5 PyPI version JSON
download
home_pagehttps://aiornot.com/
SummaryPython client for the AIORNOT API.
upload_time2024-01-03 00:00:48
maintainer
docs_urlNone
authoraiornot
requires_python>=3.9,<4.0
licenseMIT
keywords ai detection aiornot generative ai genai
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![AIORNOT Logo](./media/centered_logo_32x32.png)
# AIORNOT Python Client

![Tests](https://github.com/aiornotinc/aiornot-python/actions/workflows/test.yaml/badge.svg)
[![PyPI version](https://badge.fury.io/py/aiornot.svg)](https://badge.fury.io/py/aiornot)
[![Better Stack Badge](https://uptime.betterstack.com/status-badges/v2/monitor/y3x3.svg)](https://uptime.betterstack.com/?utm_source=status_badge)

This is a Python client for the [AIORNOT](https://aiornot.com) API.

# Getting Started

## Account Registration and API Key Generation

Register for an account at [AIORNOT](https://aiornot.com). After creating an account,
you can generate an API key via your [dashboard](https://aiornot.com/dashboard/api). If you
just created your account, the page looks like,

![](./media/no_existing_keys.png)

Click the `Request API Key` button to generate a new API key. After generating a key, the page
looks like,

![](./media/copy.png)

Press the `Copy API Key` button to copy the key to your clipboard. If you already have
generated an API key, the page looks like,

![](./media/refresh.png)

Press the `Refresh API Key` button to generate a new API key. Then press the `Copy API Key` button
to copy the key to your clipboard.

> [!WARNING]  
> Never share your API key with anyone. It is like a password.

## Installing the Python Package

To install the python package, run the following command,

```bash
pip install aiornot
```

Using the client requires an API key. You can set the API key in two ways. 

The easier and more flexible way is to set an environment variable,

```bash
AIORNOT_API_KEY=your_api_key
```

Otherwise, you can pass the api key in as an argument to the client,

```python
from aiornot import Client, AsyncClient


client = Client(api_key='your_api_key')               # sync client
async_client = AsyncClient(api_key='your_api_key')    # async client
```

Failure to set either the environment variable or the api key argument will result in a runtime error.

## View from 10,000 feet

```python
from aiornot import Client

# Create a client (reads AIORNOT_API_KEY env)
client = Client()

# Classify an image by url
resp = client.image_report_by_url('https://thispersondoesnotexist.com')

# Classify an image by path
resp = client.image_report_by_file('path/to/image.jpg')

# Classify audio by url
resp = client.audio_report_by_url('https://www.youtube.com/watch?v=v4WiI4es_UI')

# Classify audio by path
resp = client.audio_report_by_file('path/to/audio.mp3')

# Check your token
resp = client.check_token()

# Refresh your token
resp = client.refresh_token()

# Revoke your token
resp = client.revoke_token()

# Check if the API is up
resp = client.is_live()
```

There is also an async client that has the same methods as the sync client, but as coroutines.

```python
import asyncio
from aiornot import AsyncClient


async def main():
    client = AsyncClient()
    if await client.check_api():
        print('API is up!')
    else:
        print('API is down :(')


if __name__ == '__main__':
    asyncio.run(main())
```


## CLI Usage

AIOrNot also comes with a CLI. You can use it easily via a [pipx](https://pypa.github.io/pipx/) installation,

```bash
# For fresh install
pipx install aiornot

# For upgrade
pipx upgrade aiornot
```

The CLI also looks for the `AIORNOT_API_KEY` environment variable. But it will also
look for a `~/.aiornot/config.json` file if the environment variable is not set. To
set it up, run the following command,

```bash
aiornot token config
``````

and follow the prompts. Afterwards, you can see a menu of commands with,

```bash
aionot
```

the two most useful ones being,

```bash
# Classify an image by url or path
aiornot image [url|path]

# Classify audio by url or path
aionot audio [text]
```
            

Raw data

            {
    "_id": null,
    "home_page": "https://aiornot.com/",
    "name": "aiornot",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "",
    "keywords": "ai detection,aiornot,generative ai,genai",
    "author": "aiornot",
    "author_email": "support@aiornot.com",
    "download_url": "https://files.pythonhosted.org/packages/9d/54/e7249926aeb52fc24738e9411ec3ae6fa4dec1bb255c009d0a7098744d5e/aiornot-0.0.5.tar.gz",
    "platform": null,
    "description": "![AIORNOT Logo](./media/centered_logo_32x32.png)\n# AIORNOT Python Client\n\n![Tests](https://github.com/aiornotinc/aiornot-python/actions/workflows/test.yaml/badge.svg)\n[![PyPI version](https://badge.fury.io/py/aiornot.svg)](https://badge.fury.io/py/aiornot)\n[![Better Stack Badge](https://uptime.betterstack.com/status-badges/v2/monitor/y3x3.svg)](https://uptime.betterstack.com/?utm_source=status_badge)\n\nThis is a Python client for the [AIORNOT](https://aiornot.com) API.\n\n# Getting Started\n\n## Account Registration and API Key Generation\n\nRegister for an account at [AIORNOT](https://aiornot.com). After creating an account,\nyou can generate an API key via your [dashboard](https://aiornot.com/dashboard/api). If you\njust created your account, the page looks like,\n\n![](./media/no_existing_keys.png)\n\nClick the `Request API Key` button to generate a new API key. After generating a key, the page\nlooks like,\n\n![](./media/copy.png)\n\nPress the `Copy API Key` button to copy the key to your clipboard. If you already have\ngenerated an API key, the page looks like,\n\n![](./media/refresh.png)\n\nPress the `Refresh API Key` button to generate a new API key. Then press the `Copy API Key` button\nto copy the key to your clipboard.\n\n> [!WARNING]  \n> Never share your API key with anyone. It is like a password.\n\n## Installing the Python Package\n\nTo install the python package, run the following command,\n\n```bash\npip install aiornot\n```\n\nUsing the client requires an API key. You can set the API key in two ways. \n\nThe easier and more flexible way is to set an environment variable,\n\n```bash\nAIORNOT_API_KEY=your_api_key\n```\n\nOtherwise, you can pass the api key in as an argument to the client,\n\n```python\nfrom aiornot import Client, AsyncClient\n\n\nclient = Client(api_key='your_api_key')               # sync client\nasync_client = AsyncClient(api_key='your_api_key')    # async client\n```\n\nFailure to set either the environment variable or the api key argument will result in a runtime error.\n\n## View from 10,000 feet\n\n```python\nfrom aiornot import Client\n\n# Create a client (reads AIORNOT_API_KEY env)\nclient = Client()\n\n# Classify an image by url\nresp = client.image_report_by_url('https://thispersondoesnotexist.com')\n\n# Classify an image by path\nresp = client.image_report_by_file('path/to/image.jpg')\n\n# Classify audio by url\nresp = client.audio_report_by_url('https://www.youtube.com/watch?v=v4WiI4es_UI')\n\n# Classify audio by path\nresp = client.audio_report_by_file('path/to/audio.mp3')\n\n# Check your token\nresp = client.check_token()\n\n# Refresh your token\nresp = client.refresh_token()\n\n# Revoke your token\nresp = client.revoke_token()\n\n# Check if the API is up\nresp = client.is_live()\n```\n\nThere is also an async client that has the same methods as the sync client, but as coroutines.\n\n```python\nimport asyncio\nfrom aiornot import AsyncClient\n\n\nasync def main():\n    client = AsyncClient()\n    if await client.check_api():\n        print('API is up!')\n    else:\n        print('API is down :(')\n\n\nif __name__ == '__main__':\n    asyncio.run(main())\n```\n\n\n## CLI Usage\n\nAIOrNot also comes with a CLI. You can use it easily via a [pipx](https://pypa.github.io/pipx/) installation,\n\n```bash\n# For fresh install\npipx install aiornot\n\n# For upgrade\npipx upgrade aiornot\n```\n\nThe CLI also looks for the `AIORNOT_API_KEY` environment variable. But it will also\nlook for a `~/.aiornot/config.json` file if the environment variable is not set. To\nset it up, run the following command,\n\n```bash\naiornot token config\n``````\n\nand follow the prompts. Afterwards, you can see a menu of commands with,\n\n```bash\naionot\n```\n\nthe two most useful ones being,\n\n```bash\n# Classify an image by url or path\naiornot image [url|path]\n\n# Classify audio by url or path\naionot audio [text]\n```",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python client for the AIORNOT API.",
    "version": "0.0.5",
    "project_urls": {
        "Documentation": "https://github.com/aiornotinc/aiornot-python",
        "Homepage": "https://aiornot.com/",
        "Repository": "https://github.com/aiornotinc/aiornot-python"
    },
    "split_keywords": [
        "ai detection",
        "aiornot",
        "generative ai",
        "genai"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "95dad2d16e7bc52711f6457ac520e4fb7546e2b2821bcdb3a9aec9ae43284fc9",
                "md5": "fd76362e8fcbe01566a4d1685eb79663",
                "sha256": "3e8ed4f8700e93888aa217ac16dead743a1c2ed816639fdac25f666125a18ceb"
            },
            "downloads": -1,
            "filename": "aiornot-0.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fd76362e8fcbe01566a4d1685eb79663",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 8765,
            "upload_time": "2024-01-03T00:00:46",
            "upload_time_iso_8601": "2024-01-03T00:00:46.610791Z",
            "url": "https://files.pythonhosted.org/packages/95/da/d2d16e7bc52711f6457ac520e4fb7546e2b2821bcdb3a9aec9ae43284fc9/aiornot-0.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9d54e7249926aeb52fc24738e9411ec3ae6fa4dec1bb255c009d0a7098744d5e",
                "md5": "28fd4f3f71616b853b79ba7e8755670a",
                "sha256": "056a4f2a0cadce11a45c70e02fe21cecf06faad1f9c478969e871dda6a58eca7"
            },
            "downloads": -1,
            "filename": "aiornot-0.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "28fd4f3f71616b853b79ba7e8755670a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 7695,
            "upload_time": "2024-01-03T00:00:48",
            "upload_time_iso_8601": "2024-01-03T00:00:48.335291Z",
            "url": "https://files.pythonhosted.org/packages/9d/54/e7249926aeb52fc24738e9411ec3ae6fa4dec1bb255c009d0a7098744d5e/aiornot-0.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-03 00:00:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "aiornotinc",
    "github_project": "aiornot-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "aiornot"
}
        
Elapsed time: 3.78718s