Skip to content

[Feature] Improve handling of local mode & docs regarding file handling #3114

@Bibo-Joshi

Description

@Bibo-Joshi

I suggest to add a flag local_api_server/local_mode/similar naming to the Bot class which can be used to tell ptb that the bot is running against a bot api server in --local mode. Currently the benefit of that would be that we could accept file paths in all cases. In local mode, we pass the URI, otherwise we load the contents in binary mode.
If the local mode has more benefits in the future, we could leveral this setting.

What do the other team members think about this?

Additionally, we should unify the documentation on how files are handled.
Some of the classes/methods that accept file input have a note like here, but others don't. Also that note is outdated, as it doesn't explain when a pathlib.Path can be passed. It should also mention that we don't support open(file, 'r') but only open(file, 'rb'). We should either have a unified note that we add everywhere or move this snippets section to a standalone page, extend it a bit and point to it from the docs.
I'm slightly in favor of the latter.

To avoid repitition of Note: … strings in the docs, we can .. include:: them - see sphinx-doc/sphinx/issues/9939

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions