Name | tgateway JSON |
Version |
0.1.0
JSON |
| download |
home_page | None |
Summary | TGateway: the simplest way to work with a Telegram Gateway API |
upload_time | 2024-10-07 02:55:41 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | None |
keywords |
auth
sms
telegram
verify
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Telegram Gateway Python SDK
![Python](https://img.shields.io/badge/Python-3.9%2B-blue)
![License](https://img.shields.io/github/license/deus-developer/tgateway)
![Build Status](https://img.shields.io/github/actions/workflow/status/deus-developer/tgateway/release_pypi.yaml)
Telegram Gateway Python SDK is a lightweight and asynchronous client library designed to interface with the [Telegram Gateway API](https://core.telegram.org/gateway).
## โจ Features
- **Send Verification Messages**: Deliver verification codes to users' phone numbers.
- **Check Delivery Status**: Verify the status of sent messages and handle callbacks.
- **Revoke Verification**: Invalidate previously sent verification messages.
- **Integrity Validation**: Ensure authenticity of incoming reports using signature validation.
- **Easy to Use**: Designed with simplicity and usability in mind.
- **Fully Asynchronous**: Built on `asyncio` for high-performance integration.
## ๐๏ธ Installation
Install the SDK using pip:
```bash
pip install tgateway
```
## ๐ Usage
Here's a basic example to get started with the `TelegramGateway` client:
### Check a send verification message ability
```python
import asyncio
from tgateway import TelegramGateway
async def main():
async with TelegramGateway(access_token="<access-token>") as gateway:
result = await gateway.check_send_ability(
phone_number="+1234567890",
)
print(f"Verification ability: {result}")
asyncio.run(main())
```
### Send a verification message
```python
import asyncio
from tgateway import TelegramGateway
async def main():
async with TelegramGateway(access_token="<access-token>") as gateway:
result = await gateway.send_verification_message(
phone_number="+1234567890",
code_length=6
)
print(f"Verification message sent: {result}")
asyncio.run(main())
```
### Check the Status of a Verification Request
```python
import asyncio
from tgateway import TelegramGateway
async def main():
async with TelegramGateway(access_token="<access-token>") as gateway:
result = await gateway.check_verification_status(request_id="<request-id>")
print(f"Verification status: {result}")
asyncio.run(main())
```
### Revoke a Verification Message
```python
import asyncio
from tgateway import TelegramGateway
async def main():
async with TelegramGateway(access_token="<access-token>") as gateway:
result = await gateway.revoke_verification_message(request_id="<request-id>")
print(f"Verification revoked: {result}")
asyncio.run(main())
```
### Validate Incoming Delivery Reports
To confirm the origin and integrity of incoming reports, you can use the `validate_report_integrity` method provided by the SDK:
```python
import asyncio
from tgateway import TelegramGateway
async def main():
async with TelegramGateway(access_token="<access-token>") as gateway:
try:
gateway.validate_report_integrity(
timestamp=123456789, # Timestamp from header
signature="report_signature", # Signature from header
body=b'{}' # Body of the report as bytes
)
print("Report integrity validated successfully.")
except Exception as e:
print(f"Validation failed: {e}")
asyncio.run(main())
```
## ๐๏ธ Project Structure
The project is structured for ease of use and maintainability:
```
tgateway/
โโโ client.py # Main client class.
โโโ constants.py # Constants used throughout the SDK.
โโโ enums.py # Enum definitions for API statuses.
โโโ exceptions.py # Custom exception classes.
โโโ integrity.py # Integrity validation utilities.
โโโ methods.py # Implementation of Telegram Gateway API methods.
โโโ types.py # Type definitions for API responses.
```
## ๐งช Testing
Currently, the project does not have test cases but this is planned for future releases. Contributions to add tests are welcome!
## ๐ Important Links
- **Telegram Gateway Overview**: [Telegram Gateway Overview](https://core.telegram.org/gateway)
- **API Reference**: [Gateway API Reference](https://core.telegram.org/gateway/api)
- **Verification Tutorial**: [Verification Tutorial](https://core.telegram.org/gateway/verification-tutorial)
- **Manage Your Account**: [Gateway Account](https://gateway.telegram.org/account)
- **Terms of Service**: [Gateway Terms of Service](https://telegram.org/tos/gateway)
## ๐ License
This project is licensed under the [Apache License](LICENSE).
## ๐ค Contributing
Contributions are welcome! If you'd like to contribute, please fork the repository and submit a pull request. For major changes, open an issue first to discuss what you would like to change.
1. Fork the repository.
2. Create your feature branch: `git checkout -b feature/my-new-feature`.
3. Commit your changes: `git commit -m 'Add some feature'`.
4. Push to the branch: `git push origin feature/my-new-feature`.
5. Open a pull request.
## ๐ฌ Contact
For questions, support, or just to connect, please reach out to the project maintainers:
- **Email**: [deusdeveloper@yandex.com](mailto:deusdeveloper@yandex.com)
- **Telegram**: [@DeusDeveloper](https://t.me/DeusDeveloper)
- **Chat**: [@tgateway](https://t.me/tgateway)
- **GitHub Issues**: [GitHub Repository](https://github.com/deus-developer/tgateway/issues)
---
Enjoy using the Telegram Gateway Python SDK! ๐
Raw data
{
"_id": null,
"home_page": null,
"name": "tgateway",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "auth, sms, telegram, verify",
"author": null,
"author_email": "Artem Ukolov <deusdeveloper@yandex.com>",
"download_url": "https://files.pythonhosted.org/packages/a3/84/d2f3249d0d7c820e61f67288c783a68a7ebaad350e6a1bbc017f16cbedac/tgateway-0.1.0.tar.gz",
"platform": null,
"description": "# Telegram Gateway Python SDK\n\n![Python](https://img.shields.io/badge/Python-3.9%2B-blue)\n![License](https://img.shields.io/github/license/deus-developer/tgateway)\n![Build Status](https://img.shields.io/github/actions/workflow/status/deus-developer/tgateway/release_pypi.yaml)\n\nTelegram Gateway Python SDK is a lightweight and asynchronous client library designed to interface with the [Telegram Gateway API](https://core.telegram.org/gateway).\n\n## \u2728 Features\n\n- **Send Verification Messages**: Deliver verification codes to users' phone numbers.\n- **Check Delivery Status**: Verify the status of sent messages and handle callbacks.\n- **Revoke Verification**: Invalidate previously sent verification messages.\n- **Integrity Validation**: Ensure authenticity of incoming reports using signature validation.\n- **Easy to Use**: Designed with simplicity and usability in mind.\n- **Fully Asynchronous**: Built on `asyncio` for high-performance integration.\n\n## \ud83c\udfd7\ufe0f Installation\n\nInstall the SDK using pip:\n\n```bash\npip install tgateway\n```\n\n## \ud83d\udcda Usage\n\nHere's a basic example to get started with the `TelegramGateway` client:\n\n### Check a send verification message ability\n\n```python\nimport asyncio\nfrom tgateway import TelegramGateway\n\nasync def main():\n async with TelegramGateway(access_token=\"<access-token>\") as gateway:\n result = await gateway.check_send_ability(\n phone_number=\"+1234567890\",\n )\n\n print(f\"Verification ability: {result}\")\n\nasyncio.run(main())\n```\n\n### Send a verification message\n\n```python\nimport asyncio\nfrom tgateway import TelegramGateway\n\nasync def main():\n async with TelegramGateway(access_token=\"<access-token>\") as gateway:\n result = await gateway.send_verification_message(\n phone_number=\"+1234567890\",\n code_length=6\n )\n\n print(f\"Verification message sent: {result}\")\n\nasyncio.run(main())\n```\n\n### Check the Status of a Verification Request\n\n```python\nimport asyncio\nfrom tgateway import TelegramGateway\n\nasync def main():\n async with TelegramGateway(access_token=\"<access-token>\") as gateway:\n result = await gateway.check_verification_status(request_id=\"<request-id>\")\n\n print(f\"Verification status: {result}\")\n\nasyncio.run(main())\n```\n\n### Revoke a Verification Message\n\n```python\nimport asyncio\nfrom tgateway import TelegramGateway\n\nasync def main():\n async with TelegramGateway(access_token=\"<access-token>\") as gateway:\n result = await gateway.revoke_verification_message(request_id=\"<request-id>\")\n\n print(f\"Verification revoked: {result}\")\n\nasyncio.run(main())\n```\n\n### Validate Incoming Delivery Reports\n\nTo confirm the origin and integrity of incoming reports, you can use the `validate_report_integrity` method provided by the SDK:\n\n```python\nimport asyncio\nfrom tgateway import TelegramGateway\n\n\nasync def main():\n async with TelegramGateway(access_token=\"<access-token>\") as gateway:\n try:\n gateway.validate_report_integrity(\n timestamp=123456789, # Timestamp from header\n signature=\"report_signature\", # Signature from header\n body=b'{}' # Body of the report as bytes\n )\n print(\"Report integrity validated successfully.\")\n except Exception as e:\n print(f\"Validation failed: {e}\")\n\nasyncio.run(main())\n```\n\n## \ud83c\udfdb\ufe0f Project Structure\n\nThe project is structured for ease of use and maintainability:\n\n```\ntgateway/\n\u251c\u2500\u2500 client.py # Main client class.\n\u251c\u2500\u2500 constants.py # Constants used throughout the SDK.\n\u251c\u2500\u2500 enums.py # Enum definitions for API statuses.\n\u251c\u2500\u2500 exceptions.py # Custom exception classes.\n\u251c\u2500\u2500 integrity.py # Integrity validation utilities.\n\u251c\u2500\u2500 methods.py # Implementation of Telegram Gateway API methods.\n\u251c\u2500\u2500 types.py # Type definitions for API responses.\n```\n\n## \ud83e\uddea Testing\n\nCurrently, the project does not have test cases but this is planned for future releases. Contributions to add tests are welcome!\n\n## \ud83d\udd17 Important Links\n- **Telegram Gateway Overview**: [Telegram Gateway Overview](https://core.telegram.org/gateway)\n- **API Reference**: [Gateway API Reference](https://core.telegram.org/gateway/api)\n- **Verification Tutorial**: [Verification Tutorial](https://core.telegram.org/gateway/verification-tutorial)\n- **Manage Your Account**: [Gateway Account](https://gateway.telegram.org/account)\n- **Terms of Service**: [Gateway Terms of Service](https://telegram.org/tos/gateway)\n\n## \ud83d\udcc3 License\n\nThis project is licensed under the [Apache License](LICENSE).\n\n## \ud83e\udd1d Contributing\n\nContributions are welcome! If you'd like to contribute, please fork the repository and submit a pull request. For major changes, open an issue first to discuss what you would like to change.\n\n1. Fork the repository.\n2. Create your feature branch: `git checkout -b feature/my-new-feature`.\n3. Commit your changes: `git commit -m 'Add some feature'`.\n4. Push to the branch: `git push origin feature/my-new-feature`.\n5. Open a pull request.\n\n## \ud83d\udcac Contact\n\nFor questions, support, or just to connect, please reach out to the project maintainers:\n\n- **Email**: [deusdeveloper@yandex.com](mailto:deusdeveloper@yandex.com)\n- **Telegram**: [@DeusDeveloper](https://t.me/DeusDeveloper)\n- **Chat**: [@tgateway](https://t.me/tgateway)\n- **GitHub Issues**: [GitHub Repository](https://github.com/deus-developer/tgateway/issues)\n\n---\n\nEnjoy using the Telegram Gateway Python SDK! \ud83c\udf89\n",
"bugtrack_url": null,
"license": null,
"summary": "TGateway: the simplest way to work with a Telegram Gateway API",
"version": "0.1.0",
"project_urls": {
"Documentation": "https://tgateway.deusdeveloper.com/latest/getting-started/",
"Homepage": "https://tgateway.deusdeveloper.com/latest/",
"Source": "https://github.com/deus-developer/tgateway",
"Telegram": "https://t.me/tgateway",
"Tracker": "https://github.com/deus-developer/tgateway/issues"
},
"split_keywords": [
"auth",
" sms",
" telegram",
" verify"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "be227e5742b7d0484e22fb99512014a747b192de69bef0ec2b4279790a2645b4",
"md5": "b3c388288ff360ab326ac667f53cee3d",
"sha256": "8470816b0a13d0f18851008244ea343d751ca046b1d5682723de71a5c9152c03"
},
"downloads": -1,
"filename": "tgateway-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b3c388288ff360ab326ac667f53cee3d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 20038,
"upload_time": "2024-10-07T02:55:40",
"upload_time_iso_8601": "2024-10-07T02:55:40.359716Z",
"url": "https://files.pythonhosted.org/packages/be/22/7e5742b7d0484e22fb99512014a747b192de69bef0ec2b4279790a2645b4/tgateway-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a384d2f3249d0d7c820e61f67288c783a68a7ebaad350e6a1bbc017f16cbedac",
"md5": "0183ef5eb2542f1fe87489f0d24dd450",
"sha256": "afa19a5d742c77bfa5351070b2f58901b94b966a8a4bd60a49a836c5aba828e1"
},
"downloads": -1,
"filename": "tgateway-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "0183ef5eb2542f1fe87489f0d24dd450",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 22797,
"upload_time": "2024-10-07T02:55:41",
"upload_time_iso_8601": "2024-10-07T02:55:41.682007Z",
"url": "https://files.pythonhosted.org/packages/a3/84/d2f3249d0d7c820e61f67288c783a68a7ebaad350e6a1bbc017f16cbedac/tgateway-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-07 02:55:41",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "deus-developer",
"github_project": "tgateway",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "tgateway"
}