Skip to content

Commit

Permalink
bug fixes, doc improvements and version publish (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
bstoilov committed Oct 17, 2020
1 parent 79df87e commit 52feece
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions download_board_images.py
@@ -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
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
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
@@ -1 +1 @@
__version__ = '1.1.0'
__version__ = '1.1.2'

0 comments on commit 52feece

Please sign in to comment.