Skip to main content

Pinterest API client

Project description

Python Pinterest API

license MIT python 3.6 | 3.7

Getting Started

pip install pinterest-api

Usage

import pinterest

# Generate OAuth2 authorization link
link = pinterest.oauth2.authorization_url(app_id, redirect_uri)

# Initialize API by passing OAuth2 token
api = pinterest.Pinterest(token="ApFF9WBrjug_xhJPsETri2jp9pxgFVQfZNayykxFOjJQhWAw")

# Fetch authenticated user's data
api.me()

# Fetch authenticated user's boards
api.boards()

# Create board
api.board().create("Halloween", description="Fun Costumes")

# Fetch board
api.board("695665542379607495").fetch()
api.board("username/halloween").fetch()

# Fetch pins on board
api.board("username/halloween").pins()

# Edit board
api.board("username/halloween").edit(new_name="Costumes", new_description="Halloween Costume Ideas")

# Delete board
api.board("username/halloween").delete()

# Fetch board suggestions
api.suggest_boards(pin=162129655315312286)

# Fetch authenticated user's pins
api.pins()

# Create a pin
api.pin().create(board, note, link, image_url=image_url)

# Fetch a pin
api.pin(162129655315312286).fetch()

# Edit a pin
api.pin(162129655315312286).edit(board, note, link)

# Delete a pin
api.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 board
api.follow_board(board)

# Follow a user
api.follow_user(username)

# Return the users who follow the authenticated user
api.followers(cursor=None)

# Return the boards that the authenticated user follows
api.following_boards(cursor=None)

# Return the topics the authenticated user follows
api.following_interests(cursor=None)

# Return the users the authenticated user follows
api.following_users(cursor=None)

# Unfollow board
api.unfollow_board(board)

# Make authenticated user unfollow user
api.unfollow_user(username)

# Fetch another user's info
api.user(username)

# Fetch board sections
api.board("695665542379586148").sections()

# Create board section
api.board("695665542379586148").section("Section Title").create()

# Delete board section
api.board("695665542379586148").section("4989415010584246390").delete()

# Fetch pins in board section
api.board("695665542379586148").section("4989343507360527350").pins()

Responses

The Pinterest API responses are in JSON format.

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
  }
}

Resources

Pinterest Developer API
Pinterest API Explorer

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pinterest-api-0.0.8.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

pinterest_api-0.0.8-py2.py3-none-any.whl (11.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pinterest-api-0.0.8.tar.gz.

File metadata

  • Download URL: pinterest-api-0.0.8.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.0

File hashes

Hashes for pinterest-api-0.0.8.tar.gz
Algorithm Hash digest
SHA256 527416368c92f2281bd0d35d406637a5e9d1c8d019d639fcd229362ed7481b01
MD5 07ed6a60fb85922fbcee1d5852883673
BLAKE2b-256 e2d8553ae121752b7dbb1d93fe2f971cda78236496c02b07df6ac4341586d835

See more details on using hashes here.

File details

Details for the file pinterest_api-0.0.8-py2.py3-none-any.whl.

File metadata

  • Download URL: pinterest_api-0.0.8-py2.py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.0

File hashes

Hashes for pinterest_api-0.0.8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3f7ebd3e8aa3fea8f90a1b4d6ace559335971e4c1757e1ad0698339052e7482f
MD5 8d70c70cdcebb3d7037c8b478eb8b373
BLAKE2b-256 7df7b13464a0b91eeff34c7ffe4f2793f3d4e097e2a9557acc7870cb5ab46ab9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page