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

Add possibility to choose config file, implement temporary sessions #4

Merged
merged 2 commits into from
May 11, 2018
Merged

Add possibility to choose config file, implement temporary sessions #4

merged 2 commits into from
May 11, 2018

Conversation

xates
Copy link
Contributor

@xates xates commented Jan 15, 2018

  • Added the possibility to choose a configuration file by providing its path when initializing the Client, instead of using the previously hard-coded "config.ini" file
  • Allowing to set the session_name to None in order to make it "temporary", so that it won't be saved

@xates xates changed the title Added possibility to choose config file, implemented temporary sessions Add possibility to choose config file, implement temporary sessions Jan 15, 2018
@delivrance
Copy link
Member

Hi. I wonder how temporary sessions can be useful, you have to log-in with phone number and code every single time if you don't save them.

@@ -74,7 +78,8 @@ class Client:
INVITE_LINK_RE = re.compile(r"^(?:https?:\/\/)?t\.me\/joinchat\/(.+)$")
DIALOGS_AT_ONCE = 100

def __init__(self, session_name: str, test_mode: bool = False):
def __init__(self, config_file: str = "config.ini", session_name: str = None, test_mode: bool = False):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should keep session_name as the first parameter so you don't have to explicitly pass a kwarg every time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is ok for me. As you like it best.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It just seemed me conceptually right to have the config file first 😄

@xates
Copy link
Contributor Author

xates commented Jan 15, 2018

Hi! For example, when the user is logging in on a public/shared device and it is just a one-time login and he doesn't want to save any data.

Edit: that is just a use-case scenario that I imagined, currently I am not using it for that, but having a default value of None is not a big deal and surely it's not bad to have the ability to do it.

@delivrance delivrance changed the base branch from master to develop May 11, 2018 10:45
@delivrance delivrance merged commit fe2a8e6 into pyrogram:develop May 11, 2018
@xates xates deleted the choose-config-file branch June 9, 2018 18:42
@LeonardoRick
Copy link

Could you guys give an example on how to use this config.ini or another solution to change .session files location? Thanks a lot!

omg-xtao pushed a commit to TeamPGM/pyrogram that referenced this pull request Jan 7, 2024
- Added updates about a reaction change on a message with non-anonymous reactions, represented by the class MessageReactionUpdated and the field message_reaction in the class Update.
- Added updates about reaction changes on a message with anonymous reactions, represented by the class MessageReactionCountUpdated and the field message_reaction_count in the class Update.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants