linkedin-api
linkedin-api copied to clipboard
get_conversations
get_conversations return only the 20 first results .. I saw the documentation in https://linkedin.api-docs.io/v1.0/messaging/C5NLMQokSqdLZbcr8 and I see that there is an integer param createdBefore . But that doesn't work .. ? Can I have an example of something that work ?
Thank you
nice find 👍 It's not implemented but would be very easy to do so! I'd be happy to walk you through necessary steps if you'd like to contribute
Hello, Here's how I managed to do it and it works very well
def main():
linkedin = Linkedin('email', 'password')
conversations = linkedin.get_conversations()
while len(conversations['elements']) > 0:
if len(conversations['elements']) < 20:
break
else:
conversations = linkedin.get_conversations(conversations['elements'][19]['events'][0]['createdAt'])
def get_conversations(self, createdBedore=None):
"""
Return list of conversations the user is in.
"""
params = {"keyVersion": "LEGACY_INBOX"}
url = f"/messaging/conversations"
if createdBedore:
url = url + "?createdBefore=" + str(createdBedore)
res = self._fetch(url, params=params)
return res.json()
Dose anyone find solution for this?
@Tabish-Invo what's the problem with the solution above?
if you copy and paste that it does not work, there is a very simple indentation error that once fixed for me worked on the main()
function. The else
statement should refer to the if
therefore it has to be indented inside the while
loop