nusuGraph


NamenusuGraph JSON
Version 2.1 PyPI version JSON
download
home_pagehttps://github.com/Nusab19/nusuGraph
SummaryAn asynchronous and simplified Telegraph API Wrapper in Python
upload_time2023-12-28 16:19:13
maintainer
docs_urlNone
authorNusab Taha
requires_python
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # nusuGraph

An asynchronous and simplified wrapper for the Telegraph API.

## Installation

```bash
pip install -U nusugraph
```

## Usage

```python
import asyncio
from nusugraph import Telegraph


async def main():
    graph = Telegraph(
        token=None,  # if no token was passed, then an anonymous account will be created
        tokenList=None,  # list of tokens to be used in a cycle
        timeout=10,  # timeout for httpx.AsyncClient
    )

    # Create a Page
    text = "Hello, world!"

    # Account will be created if no token was passed
    response = await graph.createPage(
        author="Nusab Taha", htmlContent="<b>Hello</b>", title="Just Saying Hello"
    )
    url = response["url"]
    print(url)  # https://telegra.ph/Just-Saying-Hello-12-28-4

    # Upload Media from local file
    imagePath = "assets/sample.jpg"
    url = await graph.uploadMediaFromFile(imagePath)
    print(url)  # https://telegra.ph/file/daf9c776a1c25264321cd.jpg

    # Upload Media from it's bytes content
    with open(imagePath, "rb") as file:
        imageBytes = file.read()

    url = await graph.uploadMediaFromBytes(content=imageBytes, fileType="image/jpeg")
    print(url)  # https://telegra.ph/file/3406d7261c8c62869ab91.jpg


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

## WHY?

I needed a simple and asynchronous wrapper for the Telegraph API, with the ability to use multiple tokens in a cycle. That's the reason.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Nusab19/nusuGraph",
    "name": "nusuGraph",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Nusab Taha",
    "author_email": "nusabtaha33@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d8/62/26d487ced2b2babc17bcd76d5098675d5a5612cb61cec694afd326d9f225/nusuGraph-2.1.tar.gz",
    "platform": null,
    "description": "# nusuGraph\n\nAn asynchronous and simplified wrapper for the Telegraph API.\n\n## Installation\n\n```bash\npip install -U nusugraph\n```\n\n## Usage\n\n```python\nimport asyncio\nfrom nusugraph import Telegraph\n\n\nasync def main():\n    graph = Telegraph(\n        token=None,  # if no token was passed, then an anonymous account will be created\n        tokenList=None,  # list of tokens to be used in a cycle\n        timeout=10,  # timeout for httpx.AsyncClient\n    )\n\n    # Create a Page\n    text = \"Hello, world!\"\n\n    # Account will be created if no token was passed\n    response = await graph.createPage(\n        author=\"Nusab Taha\", htmlContent=\"<b>Hello</b>\", title=\"Just Saying Hello\"\n    )\n    url = response[\"url\"]\n    print(url)  # https://telegra.ph/Just-Saying-Hello-12-28-4\n\n    # Upload Media from local file\n    imagePath = \"assets/sample.jpg\"\n    url = await graph.uploadMediaFromFile(imagePath)\n    print(url)  # https://telegra.ph/file/daf9c776a1c25264321cd.jpg\n\n    # Upload Media from it's bytes content\n    with open(imagePath, \"rb\") as file:\n        imageBytes = file.read()\n\n    url = await graph.uploadMediaFromBytes(content=imageBytes, fileType=\"image/jpeg\")\n    print(url)  # https://telegra.ph/file/3406d7261c8c62869ab91.jpg\n\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n\n## WHY?\n\nI needed a simple and asynchronous wrapper for the Telegraph API, with the ability to use multiple tokens in a cycle. That's the reason.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "An asynchronous and simplified Telegraph API Wrapper in Python",
    "version": "2.1",
    "project_urls": {
        "Download": "https://github.com/Nusab19/nusuGraph/archive/v2.1.zip",
        "Homepage": "https://github.com/Nusab19/nusuGraph"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9298483050722f429e304ccb5b06e8afd7df5659cbc72f8cad16a142e5aeafc8",
                "md5": "71f6247e1c89b15f5fb05011e15b742b",
                "sha256": "652e4a5fb3e2d4f92a0e047800d594e55233a515d32ae0dc49e48070803628c9"
            },
            "downloads": -1,
            "filename": "nusuGraph-2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "71f6247e1c89b15f5fb05011e15b742b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6037,
            "upload_time": "2023-12-28T16:19:12",
            "upload_time_iso_8601": "2023-12-28T16:19:12.149475Z",
            "url": "https://files.pythonhosted.org/packages/92/98/483050722f429e304ccb5b06e8afd7df5659cbc72f8cad16a142e5aeafc8/nusuGraph-2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d86226d487ced2b2babc17bcd76d5098675d5a5612cb61cec694afd326d9f225",
                "md5": "db50330c46d68ef268b5115eda91a5d6",
                "sha256": "63822661e26b08deba68f381864c6b06bed73612fb023120c75300158cb1c60c"
            },
            "downloads": -1,
            "filename": "nusuGraph-2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "db50330c46d68ef268b5115eda91a5d6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5861,
            "upload_time": "2023-12-28T16:19:13",
            "upload_time_iso_8601": "2023-12-28T16:19:13.318298Z",
            "url": "https://files.pythonhosted.org/packages/d8/62/26d487ced2b2babc17bcd76d5098675d5a5612cb61cec694afd326d9f225/nusuGraph-2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-28 16:19:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Nusab19",
    "github_project": "nusuGraph",
    "github_not_found": true,
    "lcname": "nusugraph"
}
        
Elapsed time: 0.14942s