Visitar URL original
support None as config_file to avoid trying to read any file by lesinigo · Pull Request #310 · pyrogram/pyrogram · GitHub
The Wayback Machine - https://web.archive.org/web/20201210054539/https://github.com/pyrogram/pyrogram/pull/310
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support None as config_file to avoid trying to read any file #310

Closed
wants to merge 1 commit into from

Conversation

@lesinigo
Copy link

@lesinigo lesinigo commented Aug 28, 2019

There is currently no way to avoid trying to read a config_file because in the Client constructor the relevant parameter gets immediately passed through pathlib.Path()and then on to ConfigParser().read().

This PR adds support for Client(config_file=None) to avoid trying to read anything.

@delivrance
Copy link
Member

@delivrance delivrance commented May 16, 2020

@lesinigo Hi. I can't see why this is useful since files that don't exist are silently ignored and the code strictly checks for sections existence before trying to read from the parser.

For instance, using Client(...) alone would fail because no api key was provided, whereas Client(..., api_id=..., api_hash=...) works fine already.

@lesinigo
Copy link
Author

@lesinigo lesinigo commented May 16, 2020

@delivrance it's the opposite of non existent files: the PR makes possible to avoid reading an existent file; this behavior must be explicitly requested and if not used it does not change the standard behavior.

@delivrance
Copy link
Member

@delivrance delivrance commented May 16, 2020

@lesinigo I fail to understand the reasoning behind your proposal. If the config file exists, why don't you want it to be read? Also remember that arguments passed to Client already take precedence over what is read from the config file.

@delivrance delivrance closed this Aug 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.