Package: pinterest-client
pinterest-clientA simple python client for Pinterest that support user interact with
Pinterest such as simple browser.Support operations: login, pin, save pin, delete pin, boards, create
board, delete board, follow board, follow user, comment, search pins,
search users, search boards.InstallationThis package is in
pypiso you can
install it easily using pip command:pipinstallpinterest-clientor install from source code if you downloaded it fromthis GitHub
repositoryby using
command:pythonsetup.pyinstallDependenciesThis package depends on some other Python packages:requestsrequests_toolbeltThey are included in the requirements of this package so you won’t have
to manually install them.UsageAfter installation was successful, you can initialize a new pinterest
object:frompinterestimportPinterestpinterest=Pinterest(username_or_email='your_username_or_email',password='your_password')With proxiesIf you need to use a proxy, you can pass proxies argument to constructorfrompinterestimportPinterestproxies={'http':'http://10.10.1.10:3128','https':'http://10.10.1.10:1080',}pinterest=Pinterest(username_or_email='your_username_or_email',password='your_password',proxies=proxies)Custom User-AgentYou can also use your custom User-Agent string for each pinterest-client
objectfrompinterestimportPinterestagent_string='Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0'pinterest=Pinterest(username_or_email='your_username_or_email',password='your_password',agent_string=agent_string)OperationsfrompinterestimportPinterestpinterest=Pinterest(username_or_email='your_username_or_email',password='your_password')# Login to pinterest site, if 'ok' return True otherwise return Falselogged_in=pinterest.login()# Get all boards of logged in userboards=pinterest.boards()# Create new board, it also return new board data if creation was successfulpinterest.create_board(name='Board name',description='Description')# Follow a boardpinterest.follow_board(board_id='657384945546806337',board_url='/cvhautt/animal/')# Follow a userpinterest.follow_user(user_id='657385014266199005',username='cvhautt')# Create pin from an image urlpin=pinterest.pin(board_id='657384945546806337',image_url='your_image_url',description='your_description (*optional)',link='your_link (*optional)')# Create pin by uploading an image from your computeruploaded_pin=pinterest.upload_pin(board_id='657384945546806337',image_file='full_path_to_your_image',description='your_description (*optional)')# Save a pin to your board (known as Save button on Pinterest site)pinterest.repin(board_id='657385014266199005',pin_id='pin_id')# Delete a pinpinterest.delete_pin(pin_id='your_pin_id')# Comment on a pincmt=pinterest.comment(pin_id='your_pin_id',text='your_comment_text')# Delete a comment from pinpinterest.delete_comment(pin_id='your_pin_id',comment_id='your_comment_id')# Invite a person to join to your boardpinterest.invite(board_id='your_board_id',board_url='your_board_url',user_id='user_id')# Search data on Pinterest siteboards=pinterest.search_boards(query='Some query')pins=pinterest.search_pins(query='Some query')users=pinterest.search_users(query='Some query')# You can also get next page from search result by passing next_page=True to search operations above.# Exp:boards=pinterest.search_boards(query='Some query',next_page=True)pins=pinterest.search_pins(query='Some query',next_page=True)