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

Facing problem with pinning Image #148

Open
ibikhan1234 opened this issue Jun 28, 2021 · 8 comments
Open

Facing problem with pinning Image #148

ibikhan1234 opened this issue Jun 28, 2021 · 8 comments

Comments

@ibikhan1234
Copy link

ibikhan1234 commented Jun 28, 2021

I am successfully logged in.
Got Board Ids from my profile.
I have access to write and delete rights.

but still having issues like below at upload_pin function.

Successfully logged in with account jhonypinit2@gmail.com
Traceback (most recent call last):
File "c:/Users/useruser/Documents/pyqt5-test/py3pin/main.py", line 19, in
pinterest.upload_pin(board_id='789889359553000095', description='this is auto pin', title='a bot did this',image_file='./1777.jpg', link='https://www.inspiringnorah.com')
File "F:\NetBeansProjects\Instagram\instoo\Python37\lib\site-packages\py3pin\Pinterest.py", line 458, in upload_pin
image_url = self._upload_image(image_file=image_file).json()['image_url']
File "F:\NetBeansProjects\Instagram\instoo\Python37\lib\site-packages\py3pin\Pinterest.py", line 494, in _upload_image
return self.post(url=UPLOAD_IMAGE, data=form_data, headers=headers)
File "F:\NetBeansProjects\Instagram\instoo\Python37\lib\site-packages\py3pin\Pinterest.py", line 115, in post
return self.request('POST', url=url, data=data, files=files, extra_headers=headers)
File "F:\NetBeansProjects\Instagram\instoo\Python37\lib\site-packages\py3pin\Pinterest.py", line 107, in request
response.raise_for_status()
File "F:\NetBeansProjects\Instagram\instoo\Python37\lib\site-packages\requests\models.py", line 943, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://www.pinterest.com/upload-image/

@umar-farooq-khan
Copy link

Same issue. :((((((((((( Yesterday everything worked. :( after now not working after I lost my code yesterday.

@umar-farooq-khan
Copy link

oh no no, it works, the error was in email I didnt wrote @gmail.com

@anuroop18
Copy link

Is this code really working for you? @umar-farooq-khan
Because i am getting the same error but my email is correct. I don't know what is the problem.

@umar-farooq-khan
Copy link

yes it works. but only sometimes, It started giving error. but again there is always a problem with our code.
I found one reason,
one is first letter must be capital and most importantly, lower the number of characters of title and desc. start with very lower and try the code. and start increasing it. Too long title or desc will not work.

@ibikhan1234
Copy link
Author

importantly

do you have skype or facebook? lets resove the issue together.

@Nephirelle
Copy link

Nephirelle commented Jul 23, 2021

Hey guys, sounds like an interesting investigation. I made some Wireshark recordings some weeks ago while uploading pins with images via website and compared it to what is sent via py3pin. It looked quite different. The website uses HTTP2, the headers are not the same and images are uploaded as a stream. Since HTTP2 requires encrypted communication, I thought this was the reason for the "unauthorized" error. So I thought it would never work without changing the communication layer completely. Actually, I wonder how it can work by changing some text content?

Attached, you find my recordings.

Upload via py3pin
py3pin_upload

Upload via website
webpage_upload_1
webpage_upload_2

@bstoilov
Copy link
Owner

bstoilov commented May 3, 2022

That is some really advanced investigation, I usually just inspect the network tab and repeat the requests in python. Everything seems to be working locally on my machine, looks like for some reason the login fails. Try deleting the cred folder, do login and see if it get populated again

@Carnagency
Copy link

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 !

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

6 participants