{"id":15681064,"url":"https://github.com/alterxyz/ytelegraph","last_synced_at":"2025-11-03T16:44:37.418Z","repository":{"id":248204316,"uuid":"827561546","full_name":"alterxyz/YTelegraph","owner":"alterxyz","description":"Python Telegraph api.","archived":false,"fork":false,"pushed_at":"2024-08-08T22:07:05.000Z","size":29,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-26T19:04:27.062Z","etag":null,"topics":["markdown","python","telegraph","telegraph-api","telegraph-publishing"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/your-telegraph/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alterxyz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-11T22:42:22.000Z","updated_at":"2024-10-15T20:11:13.000Z","dependencies_parsed_at":"2024-07-13T04:25:18.732Z","dependency_job_id":"4424f3d0-5ef5-4c3b-a685-f12f9f2dbd09","html_url":"https://github.com/alterxyz/YTelegraph","commit_stats":null,"previous_names":["alterxyz/ytelegraph"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alterxyz%2FYTelegraph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alterxyz%2FYTelegraph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alterxyz%2FYTelegraph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alterxyz%2FYTelegraph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alterxyz","download_url":"https://codeload.github.com/alterxyz/YTelegraph/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232121496,"owners_count":18475561,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["markdown","python","telegraph","telegraph-api","telegraph-publishing"],"created_at":"2024-10-03T16:49:07.780Z","updated_at":"2025-11-03T16:44:37.366Z","avatar_url":"https://github.com/alterxyz.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# YTelegraph\n\n[![PyPi Package Version](https://img.shields.io/pypi/v/your-telegraph.svg)](https://pypi.python.org/pypi/your-telegraph)\n[![Supported Python versions](https://img.shields.io/pypi/pyversions/your-telegraph.svg)](https://pypi.python.org/pypi/your-telegraph)\n[![PyPi downloads](https://img.shields.io/pypi/dm/your-telegraph.svg)](https://pypi.org/project/your-telegraph/)\n[![PyPi status](https://img.shields.io/pypi/status/your-telegraph.svg?style=flat-square)](https://pypi.python.org/pypi/your-telegraph)\n![License](https://img.shields.io/github/license/alterxyz/ytelegraph)\n\nYTelegraph is a simple, user-friendly Python wrapper for the Telegraph API. Publish your content to Telegraph with just a few lines of code!\n\n## Table of Contents\n\n- [YTelegraph](#ytelegraph)\n    - [Table of Contents](#table-of-contents)\n    - [Installation](#installation)\n    - [Quick Start](#quick-start)\n    - [Key Features](#key-features)\n    - [Why YTelegraph?](#why-ytelegraph)\n    - [More Examples](#more-examples)\n        - [Create a page from a Markdown file](#create-a-page-from-a-markdown-file)\n        - [Use your own Telegraph token](#use-your-own-telegraph-token)\n        - [Advanced Usage](#advanced-usage)\n    - [Token Management](#token-management)\n    - [Create Account](#create-account)\n    - [Testing](#testing)\n    - [Versioning](#versioning)\n    - [Support](#support)\n    - [Contributing](#contributing)\n    - [License](#license)\n\n## Installation\n\n```bash\npip install your-telegraph\n```\n\n## Quick Start\n\nPublish a Telegraph page in just 4 lines of code:\n\n```python\nfrom ytelegraph import TelegraphAPI\n\nph = TelegraphAPI()\ncontent = \"# Hello, Telegraph!\\n\\nThis is my first Telegraph page using YTelegraph.\"\nph_link = ph.create_page_md(\"My First Page\", content)\nprint(f\"Your page is live at: {ph_link}\")\n```\n\nThat's it! No need to worry about tokens, account creation, or complex API calls.\n\n## Key Features\n\n- **Simple**: Create and publish Telegraph pages with minimal code.\n- **Markdown Support**: Write your content in Markdown and let YTelegraph handle the conversion.\n- **Flexible Token Management**: Use your own token or let YTelegraph handle account creation.\n- **Full API Access**: For advanced users, complete access to Telegraph API features is available.\n\n## Why YTelegraph?\n\n\"All you need is a title and content. That's it. Just like \u003chttps://telegra.ph/\u003e, but in Python.\"\n\nYTelegraph brings the simplicity of Telegraph's web interface to your Python projects. Whether you're creating a bot, a content management system, or just want to quickly publish some content, YTelegraph makes it easy.\n\n## More Examples\n\n### Create a page from a Markdown file\n\n```python\nfrom ytelegraph import TelegraphAPI\n\nph = TelegraphAPI()\n\nwith open('my_article.md', 'r') as f:\n    content = f.read()\n\nph_link = ph.create_page_md(\"My Article\", content)\nprint(f\"Article published at: {ph_link}\")\n```\n\n### Use your own Telegraph token\n\n```python\nfrom os import environ\nfrom ytelegraph import TelegraphAPI\n\nTELEGRA_PH_TOKEN = environ.get(\"TELEGRA_PH_TOKEN\")\n\nph = TelegraphAPI(TELEGRA_PH_TOKEN)\n```\n\nThis method is useful if you want to use an existing Telegraph account or manage tokens yourself.\n\n### Advanced Usage\n\nTry and see the `example/second_usage.py` at [here](examples/second_usage.py).\n\n## Token Management\n\nYTelegraph offers flexible token management:\n\n1. **Automatic**: If no token is provided, YTelegraph creates a new account and manages the token for you.\n2. **Environment Variable**: Set the `TELEGRA_PH_TOKEN` environment variable, and YTelegraph will use it automatically.\n3. **Direct Input**: Pass your token directly to the `TelegraphAPI` constructor.\n\nChoose the method that best fits your workflow and security requirements.\n\n## Create Account\n\nWhile YTelegraph handles account creation automatically, you might want to create your own Telegraph account for more control. Here's a quick guide:\n\n1. Visit this URL in your browser (feel free to customize the parameters):\n   `https://api.telegra.ph/createAccount?short_name=Sandbox\u0026author_name=Anonymous`\n\n   - Replace `Sandbox` with any name to help you remember this account (only visible to you)\n   - Change `Anonymous` to your preferred author name (default for your articles)\n   - Or keep them as is – it's totally fine!\n\n2. After accessing the link, you'll see a response like this:\n\n   ```json\n   {\n     \"ok\": true,\n     \"result\": {\n       \"short_name\": \"Sandbox\",\n       \"author_name\": \"Anonymous\",\n       \"author_url\": \"\",\n       \"access_token\": \"abcedfeghijklmnopqrstuvwxyz\",\n       \"auth_url\": \"https://edit.telegra.ph/auth/qwertyuiop\"\n     }\n   }\n   ```\n\n3. The `access_token` (in this example, `abcedfeghijklmnopqrstuvwxyz`) is what you'll use in your code. (Note: This is not a real token!)\n\nFor more details, check out the [Telegraph API documentation](https://telegra.ph/api#createAccount).\n\nYTelegraph makes this process super easy, but it's good to know how to do it manually if you ever need to.\n\n## Testing\n\nTo run the basic integration tests, execute the examples in the `examples/` directory:\n\n```bash\npython examples/basic_usage.py\npython examples/second_usage.py\n```\n\n## Versioning\n\nFor the versions available, see the [CHANGELOG.md](CHANGELOG.md) file.\n\n## Support\n\nIf you encounter any problems or have any questions, please [open an issue](https://github.com/alterxyz/ytelegraph/issues) on our GitHub repository.\n\n## Contributing\n\nWe welcome contributions! Feel free to submit issues or pull requests.\n\n## License\n\nYTelegraph is released under the MIT License. See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falterxyz%2Fytelegraph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falterxyz%2Fytelegraph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falterxyz%2Fytelegraph/lists"}