I am trying to update LinkedIn profile using this Python code :-
import requests
access_token = "xxx"
profile_id = "me" # "me" refers to the currently authenticated user's profile
new_headline = "New Headline Text"
new_summary = "New Summary Text"
def update_profile():
endpoint_url = f"https://api.linkedin.com/v2/me"
headers = {
"Authorization": f"Bearer {access_token}",
"Content-Type": "application/json"
}
payload = {
"headline": new_headline,
"summary": new_summary
}
response = requests.patch(endpoint_url, headers=headers, json=payload)
if response.status_code == 200:
print("Profile updated successfully.")
else:
print("Error updating profile.")
print(response.text)
if __name__ == '__main__':
update_profile()
The authorisations I have are :-
But I get this error :-
"message": "java.lang.IllegalArgumentException: No enum constant com.linkedin.restli.common.HttpMethod.PATCH",
How to fix this error ?
This is my Python environment
from How can I update LinkedIn Basic profile in Python
No comments:
Post a Comment