
Security News
Bun 1.2.19 Adds Isolated Installs for Better Monorepo Support
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
Telegram Gateway Python SDK is a lightweight and asynchronous client library designed to interface with the Telegram Gateway API.
asyncio
for high-performance integration.Install the SDK using pip:
pip install tgateway
Here's a basic example to get started with the TelegramGateway
client:
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())
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())
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())
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())
To confirm the origin and integrity of incoming reports, you can use the validate_report_integrity
method provided by the SDK:
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())
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.
Currently, the project does not have test cases but this is planned for future releases. Contributions to add tests are welcome!
This project is licensed under the Apache License.
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.
git checkout -b feature/my-new-feature
.git commit -m 'Add some feature'
.git push origin feature/my-new-feature
.For questions, support, or just to connect, please reach out to the project maintainers:
Enjoy using the Telegram Gateway Python SDK! 🎉
FAQs
TGateway: the simplest way to work with a Telegram Gateway API
We found that tgateway demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
Security News
Popular npm packages like eslint-config-prettier were compromised after a phishing attack stole a maintainer’s token, spreading malicious updates.
Security News
/Research
A phishing attack targeted developers using a typosquatted npm domain (npnjs.com) to steal credentials via fake login pages - watch out for similar scams.