Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Native support for TGs test environment #3355

Closed
@Bibo-Joshi

Description

@Bibo-Joshi

By now, TGsdedicated test environment is more prominently documented. Adding native support for it in PTB could be a desribale feature.

⚠️ Current status

This feature is currently not on any roadmap, since it doesn't seem to be widely used. If you would like for PTB to have this feature, please react with a 👍 to the comment. If we see a large number of requests, this issue will likely get put on a roadmap.

Edit: One can trick PTB into using the test env by settingtoken='<token>/test'. But this hack is not guaranteed to keep working in future versions of PTB …

Count of thumbs up over time, status 2024-12-31:

Image

For future reference: GraphQL query to get the data
{repository(owner:"python-telegram-bot",name:"python-telegram-bot") {issue(number:3355) {reactions(first:100) {nodes{contentcreatedAtuser {login          }        }      }    }  }}

Open Questions

We should check how the url returned byget_file behave, i.e. if they are stillhttps://api.telegram.org/file/bot<Token>/… or if they are e.g.https://api.telegram.org/file/bot<token>/test/….

Implementation options

Just quickly listing two options that come to my mind

Atest_env flag

That would work viaApplicationBuilder().token(…).test_env(True) orBot(…, test_env=True) . This would be non-breaking. However, if may not play nicely with custombase_file_url depending on what we find out about file urls.

Allow custom insertion of token intobase(_file)_url

That could either work by requesting the user to pass something likebase_url = 'api.telegram.org/bot{token}/' (this would be a breaking change) or by allowing the user to pass aCallable[[str], str] that accepts the token and returns the (file_)url (this could be implemented in a non-breaking manner)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp