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

Pinterest.pin error #55

Closed
Aarushi-Ign opened this issue Apr 6, 2020 · 3 comments
Closed

Pinterest.pin error #55

Aarushi-Ign opened this issue Apr 6, 2020 · 3 comments

Comments

@Aarushi-Ign
Copy link

Hello, I am facing an issue. The board ID is correct.
Traceback (most recent call last):
File "pinit.py", line 42, in
pinterest.pin(board_id='771874892324362501', section_id=None, image_url=image_file, description=description, title=title, link=link)
File "/usr/local/lib/python3.5/dist-packages/py3pin/Pinterest.py", line 270, in pin
return self.post(url=PIN_RESOURCE_CREATE, data=data)
File "/usr/local/lib/python3.5/dist-packages/py3pin/Pinterest.py", line 106, in post
return self.request('POST', url=url, data=data, files=files, extra_headers=headers)
File "/usr/local/lib/python3.5/dist-packages/py3pin/Pinterest.py", line 98, in request
response.raise_for_status()
File "/usr/local/lib/python3.5/dist-packages/requests/models.py", line 941, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://www.pinterest.com/resource/PinResource/create/

Can you help?

@bstoilov
Copy link
Owner

bstoilov commented Apr 7, 2020

Can you post you code

@Aarushi-Ign
Copy link
Author

It's quite simple really. Just as descriped in the package py3pin

from py3pin.Pinterest import Pinterest
pinterest = Pinterest(email='XXXXX@outlook.com', password='XXXXX', username='XXXXX', cred_root='/var/www/data')
print (pinterest.boards(username='XXXXX'))

image_file = '/var/www/abcd.png'
title = 'ABCD'
description = 'abcd'
link = 'http://icoronavirus19.com'
pinterest.pin(board_id=771874892324362501, section_id=None, image_url=image_file, description=description, title=title, link=link)

@bstoilov
Copy link
Owner

bstoilov commented Apr 7, 2020

The image url needs to be web url, to upload local image you need to use

def upload_pin(board_id='',
               section_id=None,
               image_path='my_imag.png',
               description='this is auto pin',
               title='a bot did this',
               link='https://www.google.com/'):
    return pinterest.upload_pin(board_id=board_id, section_id=section_id, image_file=image_path,
                                description=description, title=title, link=link)

from the examples.py

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

2 participants