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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: logout #197

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

alvaroserrrano
Copy link
Contributor

No description provided.

"takeoverFlow": "SIGN_OUT",
}
url = f"/takeovers"
url_params["updateId"] = "activity:" + post_urn
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this line required?

@@ -96,6 +96,21 @@ def _post(self, uri, evade=default_evade, base_request=False, **kwargs):
url = f"{self.client.API_BASE_URL if not base_request else self.client.LINKEDIN_BASE_URL}{uri}"
return self.client.session.post(url, **kwargs)

def logout(self):
"""GET request to log user out"""
Copy link
Collaborator

Choose a reason for hiding this comment

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

I dont think its necessary to mention it is a GET request. It would be enough to just mention what the method does. In this case it could . Logs out of the current session.
What is your opinion on having a return type of bool which would be true on success and false on failure to logout.

@alvaroserrrano alvaroserrrano marked this pull request as ready for review January 4, 2022 09:21
url_params = {
"q": "takeoverFlow",
"takeoverFlow": "SIGN_OUT",
}
url = f"/takeovers"
url_params["updateId"] = "activity:" + post_urn
res = self._fetch(url, params=url_params)
data = res.json()
if data and "status" in data and data["status"] != 200:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you forgot to remove these 3 lines.

res = self._fetch(url, params=url_params)
data = res.json()
if data and "status" in data and data["status"] != 200:
self.logger.info("request failed: {}".format(data["status"]))
return {}
return data
if data and "status" in data and data["status"] == 200:
return True
Copy link
Collaborator

@abinpaul1 abinpaul1 Jan 4, 2022

Choose a reason for hiding this comment

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

No harm in keeping the logging statement when the request returns failure

@abinpaul1
Copy link
Collaborator

abinpaul1 commented Jan 4, 2022

Just confirming, did you try testing the other available methods after logout. Ideally they shouldn鈥檛 work and throw some errors after the logout. Could you please confirm the behaviour?

@engahmed1190
Copy link

@alvaroserrrano @abinpaul1 is this pull request valid, it is a very important feature logout from the current session. I have tried it and it returns {'elements': [{'globalLegoTrackingToken': 'XXXX', 'legoTrackingToken': 'XXXX', 'takeoverType': 'ABI'}], 'paging': {'count': 10, 'start': 0, 'total': 1, 'links': []}}

@abinpaul1
Copy link
Collaborator

abinpaul1 commented Mar 2, 2022

I am not sure if the changes in this PR were tested. @alvaroserrrano can maybe confirm.

@engahmed1190 Are you able to use other methods after logout is called?
Maybe you could verify by visiting LinkedIn and cheking if the session is still active or not. It can be viewed under Settings -> Sign in & Security -> Account access -> Where you're signed in.

@engahmed1190
Copy link

The session is still active after using the logout

@abinpaul1
Copy link
Collaborator

Oh, then it seems we have missed some logic in the logout flow. We currently only do a get request to endpoint mentioned in #191 . It requires further investigation i suppose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants