API Reference¶
This page is generated from source code docstrings and signatures via mkdocstrings.
Package¶
telegras ¶
telegras - Telegram + FastAPI focused integration service.
create_app ¶
create_app(*, app=None, settings=None, service=None, merge_lifespan=True)
Create or configure the FastAPI application.
This function can either create a new standalone FastAPI app or mount telegras routes onto an existing FastAPI app.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
FastAPI | None
|
Optional existing FastAPI app to mount routes onto. If None, creates a new standalone app. |
None
|
settings
|
AppSettings | None
|
Optional application settings. If None, loads from environment. |
None
|
service
|
TelegramIngestionService | None
|
Optional TelegramIngestionService instance. If None, creates one. |
None
|
merge_lifespan
|
bool
|
Whether to merge lifespans when mounting on existing app. Only applicable when app is provided. |
True
|
Returns:
| Type | Description |
|---|---|
FastAPI
|
The configured FastAPI application (new or provided) |
get_file_direct_url
async
¶
get_file_direct_url(file_id)
Given a Telegram file_id, return a direct HTTPS URL for that file.
Note: This URL is temporary and should be used only to download once.
Key modules¶
telegras.app ¶
create_app ¶
create_app(*, app=None, settings=None, service=None, merge_lifespan=True)
Create or configure the FastAPI application.
This function can either create a new standalone FastAPI app or mount telegras routes onto an existing FastAPI app.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app
|
FastAPI | None
|
Optional existing FastAPI app to mount routes onto. If None, creates a new standalone app. |
None
|
settings
|
AppSettings | None
|
Optional application settings. If None, loads from environment. |
None
|
service
|
TelegramIngestionService | None
|
Optional TelegramIngestionService instance. If None, creates one. |
None
|
merge_lifespan
|
bool
|
Whether to merge lifespans when mounting on existing app. Only applicable when app is provided. |
True
|
Returns:
| Type | Description |
|---|---|
FastAPI
|
The configured FastAPI application (new or provided) |