bstoilov / py3-pinterest

Fully fledged Python Pinterest client
MIT License
293 stars 104 forks source link

401 Client Error: Unauthorized for url #172

Closed miguelhentoux closed 2 years ago

miguelhentoux commented 2 years ago

I can't create a pin or a board, I always have the same error: 401 Client Error: HTTPError: 401 Client Error: Unauthorized for url: https://www.pinterest.com/resource/PinResource/create/ Can you help me?

pinterest = Pinterest(email=email,
                      password=password,
                      username=username,
                      cred_root='cred_root')
logged_in = pinterest.login()
boards = pinterest.boards(username=username)
board_id = boards[0]["id"]
pinterest.pin(board_id=board_id,
              image_url=image_url,
              description="foo123",
              title="bar123")
thib66 commented 2 years ago

Hello, perhaps you have a redirection from pinterest.com to the pinterest website of your country. In the file Pinterest.py of the library I had to change : driver.get("https://pinterest.com/login") by driver.get("https://pinterest.fr/login") and driver.find_elements_by_xpath("//[contains(text(), 'Log in')]") by driver.find_elements_by_xpath("//[contains(text(), 'Se connecter')]") May you check if the file related to cookies is correctly generated in the folder cred_root?

In my script I also call directly pinterest.login().

Thanks in advance for the answer, Regards

bstoilov commented 2 years ago

Closing due to inactivity

victorviro commented 1 year ago

I get this error when performing some actions like repin, unfollow, get followers/following of user... For other actions like get user overview or get boards of user it works correctly. Tested with different accounts. The file related to cookies is correctly generated. Version of py3-pinterest 1.3.0

Carnagency commented 4 months ago

I have tried a lot of the things that were discussed in all the different conversations of the repositery.

I was really hopeless and I found that it was simply due to me living in a non-english country so I just had to change the settings of my pinterest account and put US in country and american english in language.

Check this link out :

https://docs.contentstudio.io/article/497-pinterest-post-failed-to-publish#:~:text=Authorization%20Problem%3A%20If%20you%20are,the%20account%20to%20the%20English.

Hope this will help some fellow coders !