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_connection no longer works: 301-Ressource moved #448

Open
BirT356 opened this issue Oct 24, 2024 · 4 comments
Open

add_connection no longer works: 301-Ressource moved #448

BirT356 opened this issue Oct 24, 2024 · 4 comments

Comments

@BirT356
Copy link

BirT356 commented Oct 24, 2024

Since yesterday, endpoint for add connection seems to be still there, but the "invitee": {"com.linkedin.voyager.growth.invitation.InviteeProfile": {"profileId": <profile_urn_id>}},
seems to throw an error: with the code 301 - Ressource Moved.

Where is actually this endpoint on the browser? I can't find it anywhere. The one in the browser (voyager-relationship endpoint ) always invalidates the client which is really annoying.

Orginal code:
tracking_id = generate_trackingId() payload = { "trackingId": tracking_id, "message": message, "invitations": [], "excludeInvitations": [], "invitee": {"com.linkedin.voyager.growth.invitation.InviteeProfile": {"profileId": profile_urn_id}}, } res = self._post( "/growth/normInvitations", data=json.dumps(payload), headers={"accept": "application/vnd.linkedin.normalized+json+2.1"}, )

@Alegrossi2001
Copy link

Same happening here

@dino-exela
Copy link

dino-exela commented Oct 31, 2024

I tried to debug also but could not found a way. On website I couldn't find any similiar api that they are using behind the scene when connection request is sent.

So, I tried to mimic add_connection method by using _post in same class (Linkedin class) and that is giving {'data': {'status': 422}, 'included': []} as a res.json() output.

Here's code:

import random
import base64

def generate_trackingId() -> str:
    random_int_array = [random.randrange(256) for _ in range(16)]
    rand_byte_array = bytearray(random_int_array)
    return str(base64.b64encode(rand_byte_array))[2:-1]

trackingId = generate_trackingId()
payload = {
    "trackingId": trackingId,
    "message": None,
    "invitations": [],
    "excludeInvitations": [],
    "invitee": {
        "com.linkedin.voyager.growth.invitation.InviteeProfile": {
            "profileId": <SOME URN ID>
        }
    },
}

api = Linkedin(link_username, link_password, cookies=cookie_jar)

res = api._post(
    "/growth/normInvitations",
    data=json.dumps(payload),
    headers={"accept": "application/vnd.linkedin.normalized+json+2.1"},
)

print(res.json())

Someone, please look into it and find a way through it.

@dahani9091
Copy link

Sam happening to me; please lets collaborate to solve this issue!

@yashdharme
Copy link

yashdharme commented Nov 1, 2024

Hi guys,

I have resolved the issue and tested the same. Also I have raised the Pull Request #453 to address this issue.

@BirT356 @Alegrossi2001 @dahani9091 @yash-exela

Kindly do the needful for merge.

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

No branches or pull requests

5 participants