Pinterest API客户端
pinterest-api的Python项目详细描述
Python Pinterest API
开始
pip install pinterest-api
用法
importpinterest# Generate OAuth2 authorization linklink=pinterest.oauth2.authorization_url(app_id,redirect_uri)# Initialize API by passing OAuth2 tokenapi=pinterest.Pinterest(token="ApFF9WBrjug_xhJPsETri2jp9pxgFVQfZNayykxFOjJQhWAw")# Fetch authenticated user's dataapi.me()# Fetch authenticated user's boardsapi.boards()# Create boardapi.board().create("Halloween",description="Fun Costumes")# Fetch boardapi.board("695665542379607495").fetch()api.board("username/halloween").fetch()# Fetch pins on boardapi.board("username/halloween").pins()# Edit boardapi.board("username/halloween").edit(new_name="Costumes",new_description="Halloween Costume Ideas")# Delete boardapi.board("username/halloween").delete()# Fetch board suggestionsapi.suggest_boards(pin=162129655315312286)# Fetch authenticated user's pinsapi.pins()# Create a pinapi.pin().create(board,note,link,image_url=image_url)# Fetch a pinapi.pin(162129655315312286).fetch()# Edit a pinapi.pin(162129655315312286).edit(board,note,link)# Delete a pinapi.pin(162129655315312286).delete()# Search boards (Optional cursor)api.search_boards(query,cursor=None)# Search pins (Optional cursor)api.search_pins(query,cursor=None)# Follow a boardapi.follow_board(board)# Follow a userapi.follow_user(username)# Return the users who follow the authenticated userapi.followers(cursor=None)# Return the boards that the authenticated user followsapi.following_boards(cursor=None)# Return the topics the authenticated user followsapi.following_interests(cursor=None)# Return the users the authenticated user followsapi.following_users(cursor=None)# Unfollow boardapi.unfollow_board(board)# Make authenticated user unfollow userapi.unfollow_user(username)# Fetch another user's infoapi.user(username)# Fetch board sectionsapi.board("695665542379586148").sections()# Create board sectionapi.board("695665542379586148").section("Section Title").create()# Delete board sectionapi.board("695665542379586148").section("4989415010584246390").delete()# Fetch pins in board sectionapi.board("695665542379586148").section("4989343507360527350").pins()
响应
pinterest api响应是json格式的。
api.me()# By default, retry http request up to 3 times
{"data":{"first_name":"Bryan","id":"695665611098925391","last_name":"Andrade","url': "https://www.pinterest.com/bandrade1815/"},"ratelimit":{"limit":10,"remaining":9}}
资源
Pinterest Developer API
Pinterest API Explorer