From 47f1faba443d06259d23a0ea3df1e41859c79622 Mon Sep 17 00:00:00 2001 From: Paulo Romeira Date: Sun, 6 May 2018 04:48:44 -0300 Subject: [PATCH] Little tweaks to Unlogged --- onegram/__init__.py | 4 ++-- onegram/session.py | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/onegram/__init__.py b/onegram/__init__.py index 3806931..5eb1375 100644 --- a/onegram/__init__.py +++ b/onegram/__init__.py @@ -1,5 +1,5 @@ -from .session import Login -from .session import login, logout +from .session import Login, Unlogged +from .session import login, logout, close from .actions import follow, unfollow from .actions import like, unlike diff --git a/onegram/session.py b/onegram/session.py index 6514ca3..b8cf9ce 100644 --- a/onegram/session.py +++ b/onegram/session.py @@ -222,10 +222,17 @@ def login(*args, **kwargs): @_sessionaware -def logout(session): +def close(session): session.close() +logout = close + + +def unlogged(*args, **kwargs): + return Unlogged(*args, **kwargs).open() + + def _load_settings(custom_settings={}): settings = {k:getattr(settings_module, k) for k in dir(settings_module) if k.isupper()}