# YTelegraph
YTelegraph is a simple, user-friendly Python wrapper for the Telegraph API. Publish your content to Telegraph with just a few lines of code!
## Table of Contents
- [YTelegraph](#ytelegraph)
- [Table of Contents](#table-of-contents)
- [Installation](#installation)
- [Quick Start](#quick-start)
- [Key Features](#key-features)
- [Why YTelegraph?](#why-ytelegraph)
- [More Examples](#more-examples)
- [Create a page from a Markdown file](#create-a-page-from-a-markdown-file)
- [Use your own Telegraph token](#use-your-own-telegraph-token)
- [Token Management](#token-management)
- [Testing](#testing)
- [Versioning](#versioning)
- [Support](#support)
- [Contributing](#contributing)
- [License](#license)
## Installation
```bash
pip install your-telegraph
```
## Quick Start
Publish a Telegraph page in just 4 lines of code:
```python
from ytelegraph import TelegraphAPI
ph = TelegraphAPI()
content = "# Hello, Telegraph!\n\nThis is my first Telegraph page using YTelegraph."
ph_link = ph.create_page_md("My First Page", content)
print(f"Your page is live at: {ph_link}")
```
That's it! No need to worry about tokens, account creation, or complex API calls.
## Key Features
- **Simple**: Create and publish Telegraph pages with minimal code.
- **Markdown Support**: Write your content in Markdown and let YTelegraph handle the conversion.
- **Flexible Token Management**: Use your own token or let YTelegraph handle account creation.
- **Full API Access**: For advanced users, complete access to Telegraph API features is available.
## Why YTelegraph?
"All you need is a title and content. That's it. Just like <https://telegra.ph/>, but in Python."
YTelegraph 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.
## More Examples
### Create a page from a Markdown file
```python
from ytelegraph import TelegraphAPI
ph = TelegraphAPI()
with open('my_article.md', 'r') as f:
content = f.read()
ph_link = ph.create_page_md("My Article", content)
print(f"Article published at: {ph_link}")
```
### Use your own Telegraph token
```python
from os import environ
from ytelegraph import TelegraphAPI
TELEGRA_PH_TOKEN = environ.get("TELEGRA_PH_TOKEN")
ph = TelegraphAPI(TELEGRA_PH_TOKEN)
```
This method is useful if you want to use an existing Telegraph account or manage tokens yourself.
## Token Management
YTelegraph offers flexible token management:
1. **Automatic**: If no token is provided, YTelegraph creates a new account and manages the token for you.
2. **Environment Variable**: Set the `TELEGRA_PH_TOKEN` environment variable, and YTelegraph will use it automatically.
3. **Direct Input**: Pass your token directly to the `TelegraphAPI` constructor.
Choose the method that best fits your workflow and security requirements.
## Testing
To run the basic integration tests, execute the examples in the `examples/` directory:
```bash
python examples/basic_usage.py
python examples/advanced_usage.py
```
## Versioning
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [CHANGELOG.md](CHANGELOG.md) file.
## Support
If you encounter any problems or have any questions, please [open an issue](https://github.com/alterxyz/ytelegraph/issues) on our GitHub repository.
## Contributing
We welcome contributions! Feel free to submit issues or pull requests.
## License
YTelegraph is released under the MIT License. See [LICENSE](LICENSE) for details.
Raw data
{
"_id": null,
"home_page": "https://github.com/alterxyz/ytelegraph",
"name": "ytelegraph",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "telegraph api wrapper markdown publishing",
"author": "alterxyz",
"author_email": "88554920+alterxyz@users.noreply.github.com",
"download_url": "https://files.pythonhosted.org/packages/db/57/0fa66ecd737c29f08ff8eafbf999f1493a50e11812e0e4a0ee627bac81d1/ytelegraph-0.1.3.tar.gz",
"platform": null,
"description": "# YTelegraph\r\n\r\nYTelegraph is a simple, user-friendly Python wrapper for the Telegraph API. Publish your content to Telegraph with just a few lines of code!\r\n\r\n## Table of Contents\r\n- [YTelegraph](#ytelegraph)\r\n - [Table of Contents](#table-of-contents)\r\n - [Installation](#installation)\r\n - [Quick Start](#quick-start)\r\n - [Key Features](#key-features)\r\n - [Why YTelegraph?](#why-ytelegraph)\r\n - [More Examples](#more-examples)\r\n - [Create a page from a Markdown file](#create-a-page-from-a-markdown-file)\r\n - [Use your own Telegraph token](#use-your-own-telegraph-token)\r\n - [Token Management](#token-management)\r\n - [Testing](#testing)\r\n - [Versioning](#versioning)\r\n - [Support](#support)\r\n - [Contributing](#contributing)\r\n - [License](#license)\r\n\r\n## Installation\r\n\r\n```bash\r\npip install your-telegraph\r\n```\r\n\r\n## Quick Start\r\n\r\nPublish a Telegraph page in just 4 lines of code:\r\n\r\n```python\r\nfrom ytelegraph import TelegraphAPI\r\n\r\nph = TelegraphAPI()\r\ncontent = \"# Hello, Telegraph!\\n\\nThis is my first Telegraph page using YTelegraph.\"\r\nph_link = ph.create_page_md(\"My First Page\", content)\r\nprint(f\"Your page is live at: {ph_link}\")\r\n```\r\n\r\nThat's it! No need to worry about tokens, account creation, or complex API calls.\r\n\r\n## Key Features\r\n\r\n- **Simple**: Create and publish Telegraph pages with minimal code.\r\n- **Markdown Support**: Write your content in Markdown and let YTelegraph handle the conversion.\r\n- **Flexible Token Management**: Use your own token or let YTelegraph handle account creation.\r\n- **Full API Access**: For advanced users, complete access to Telegraph API features is available.\r\n\r\n## Why YTelegraph?\r\n\r\n\"All you need is a title and content. That's it. Just like <https://telegra.ph/>, but in Python.\"\r\n\r\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.\r\n\r\n## More Examples\r\n\r\n### Create a page from a Markdown file\r\n\r\n```python\r\nfrom ytelegraph import TelegraphAPI\r\n\r\nph = TelegraphAPI()\r\n\r\nwith open('my_article.md', 'r') as f:\r\n content = f.read()\r\n\r\nph_link = ph.create_page_md(\"My Article\", content)\r\nprint(f\"Article published at: {ph_link}\")\r\n```\r\n\r\n### Use your own Telegraph token\r\n\r\n```python\r\nfrom os import environ\r\nfrom ytelegraph import TelegraphAPI\r\n\r\nTELEGRA_PH_TOKEN = environ.get(\"TELEGRA_PH_TOKEN\")\r\n\r\nph = TelegraphAPI(TELEGRA_PH_TOKEN)\r\n```\r\n\r\nThis method is useful if you want to use an existing Telegraph account or manage tokens yourself.\r\n\r\n## Token Management\r\n\r\nYTelegraph offers flexible token management:\r\n\r\n1. **Automatic**: If no token is provided, YTelegraph creates a new account and manages the token for you.\r\n2. **Environment Variable**: Set the `TELEGRA_PH_TOKEN` environment variable, and YTelegraph will use it automatically.\r\n3. **Direct Input**: Pass your token directly to the `TelegraphAPI` constructor.\r\n\r\nChoose the method that best fits your workflow and security requirements.\r\n\r\n## Testing\r\n\r\nTo run the basic integration tests, execute the examples in the `examples/` directory:\r\n\r\n```bash\r\npython examples/basic_usage.py\r\npython examples/advanced_usage.py\r\n```\r\n\r\n## Versioning\r\n\r\nWe use [SemVer](http://semver.org/) for versioning. For the versions available, see the [CHANGELOG.md](CHANGELOG.md) file.\r\n\r\n## Support\r\n\r\nIf you encounter any problems or have any questions, please [open an issue](https://github.com/alterxyz/ytelegraph/issues) on our GitHub repository.\r\n\r\n## Contributing\r\n\r\nWe welcome contributions! Feel free to submit issues or pull requests.\r\n\r\n## License\r\n\r\nYTelegraph is released under the MIT License. See [LICENSE](LICENSE) for details.\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A simple Python wrapper for the Telegraph API",
"version": "0.1.3",
"project_urls": {
"Bug Tracker": "https://github.com/alterxyz/ytelegraph/issues",
"Documentation": "https://github.com/alterxyz/ytelegraph/blob/main/README.md",
"Homepage": "https://github.com/alterxyz/ytelegraph",
"Source Code": "https://github.com/alterxyz/ytelegraph"
},
"split_keywords": [
"telegraph",
"api",
"wrapper",
"markdown",
"publishing"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "289dca97725d02a2b14b6b7e3a921006eaff40db9bb8abe9f6d441ec7ca61210",
"md5": "09ce576d7b4afb6988ec5f1c38f80106",
"sha256": "30b5621bcbe6302606203f155199c5414a85e41466f3957fca1b23623c8227ef"
},
"downloads": -1,
"filename": "ytelegraph-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "09ce576d7b4afb6988ec5f1c38f80106",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 11169,
"upload_time": "2024-07-14T11:08:16",
"upload_time_iso_8601": "2024-07-14T11:08:16.531317Z",
"url": "https://files.pythonhosted.org/packages/28/9d/ca97725d02a2b14b6b7e3a921006eaff40db9bb8abe9f6d441ec7ca61210/ytelegraph-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "db570fa66ecd737c29f08ff8eafbf999f1493a50e11812e0e4a0ee627bac81d1",
"md5": "58a85ba18e0a64c952a03c36190742c8",
"sha256": "f88d50ba7ec41161498aee2bbb65759544b401fd4df97093a249ff27a2760287"
},
"downloads": -1,
"filename": "ytelegraph-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "58a85ba18e0a64c952a03c36190742c8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 11564,
"upload_time": "2024-07-14T11:08:18",
"upload_time_iso_8601": "2024-07-14T11:08:18.098816Z",
"url": "https://files.pythonhosted.org/packages/db/57/0fa66ecd737c29f08ff8eafbf999f1493a50e11812e0e4a0ee627bac81d1/ytelegraph-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-14 11:08:18",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "alterxyz",
"github_project": "ytelegraph",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "ytelegraph"
}