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

bug fixes, doc improvements and version publish #87

Merged
merged 1 commit into from
Oct 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions download_board_images.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from py3pin.Pinterest import Pinterest
import requests
import os

download_dir = '.'
download_dir = './pinterest_images/'
if not os.path.exists(download_dir):
os.makedirs(download_dir)

pinterest = Pinterest(email='email',
password='password',
Expand All @@ -18,14 +21,14 @@
board_pins = []
pin_batch = pinterest.board_feed(board_id=target_board['id'])


while len(pin_batch) > 0:
board_pins += pin_batch
pin_batch = pinterest.board_feed(board_id=target_board['id'])


# this can download images by url
def download_image(url, path):
print("Downloading " + url)
r = requests.get(url=url, stream=True)
if r.status_code == 200:
with open(path, 'wb') as f:
Expand Down
1 change: 1 addition & 0 deletions py3pin/Pinterest.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,7 @@ def search(self, scope, query, page_size=250):
"""
Gives access to pinterest search api
This method is batched, meaning is needs to be called until empty list is returned.
NOTE: there is a max number of results set by Pinterest -> 1000
:param scope: can be pins, buyable_pins, my_pins, videos, boards
:param query: search phrase
:param page_size: batch size
Expand Down
4 changes: 3 additions & 1 deletion py3pin/RequestBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ def buildGet(self, url, options, source_url='/', context=None):
'_': '%s' % int(time.time() * 1000)
})

return '{}/?{}'.format(url, data)
url = '{}/?{}'.format(url, data)
url = url.replace('/get//?', '/get/?')
return url

def url_encode(self, query):
if isinstance(query, str):
Expand Down
2 changes: 1 addition & 1 deletion py3pin/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.1.0'
__version__ = '1.1.2'