tomquirk / linkedin-api

👨‍💼 LinkedIn API for Python
https://pypi.org/project/linkedin-api
MIT License
1.94k stars 430 forks source link

get_profile_connections() issue #407

Closed yaruqian closed 3 weeks ago

yaruqian commented 2 months ago

hi,

It seems get_profile_connections() returns all the connections of my own account(the one that I use to login), which is to say that no matter what urn_id I put in, it returns the same results. Does anyone also suffer from the same issue?

Yaru

EseToni commented 1 month ago

@yaruqian hi, doing some research, I realized that it returns the common connections between the urn_id and the logged in account, I'm investigating a way to see if the urn_id is already among your connections if you find something communicate!

yaruqian commented 1 month ago

@EseToni Thank you for sharing the information, however, I don't think urn_id is among my connections, since I only have 9 connections in my logged-in account and there are more than 1k urn_id I would like to search, all these 1k urn_id were returning my 9 connections' information.

EseToni commented 1 month ago

@yaruqian I recently find a method to know if the profile is in your network ` try: profile = api.get_profile_network_info(public_profile_id=data['public_identifier']) except Exception as e: return { 'success': False, 'type': 'not_found'}

if profile['distance']['value'] == 'DISTANCE_1':
    return { 'success': True, 'type': 'success'} // the user is on your network
elif profile['distance']['value'] == 'OUT_OF_NETWORK':
    return { 'success': False, 'type': 'rejected'} // out the network
else:
    return { 'success': False, 'type': 'pending', 'next_work': 'check-invitation'} // pending

`

tomquirk commented 3 weeks ago

@yaruqian @EseToni I've fixed this issue on the main branch (pending PyPI release).

For the meantime, I think if you pass in network_depth=None, it should work as you expect.

profiles = api.get_profile_connections('tom-quirk', network_depth=None)
tomquirk commented 3 weeks ago

This is included in the v2.3.0 release. https://github.com/tomquirk/linkedin-api/releases/tag/v2.3.0