Skip to main content

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

Release files for pinterest-api 0.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pinterest-api 0.0.8
File Size Uploaded
pinterest-api-0.0.8.tar.gz 10.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pinterest-api 0.0.8
File Interpreter ABI Platform
pinterest_api-0.0.8-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 21.6 kB

Release files / pinterest-api-0.0.8.tar.gz

Download URL pinterest-api-0.0.8.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
527416368c92f2281bd0d35d406637a5e9d1c8d019d639fcd229362ed7481b01
BLAKE2b-256 checksum
How to use checksums
e2d8553ae121752b7dbb1d93fe2f971cda78236496c02b07df6ac4341586d835
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / pinterest_api-0.0.8-py2.py3-none-any.whl

Download URL pinterest_api-0.0.8-py2.py3-none-any.whl
Size 11.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
3f7ebd3e8aa3fea8f90a1b4d6ace559335971e4c1757e1ad0698339052e7482f
BLAKE2b-256 checksum
How to use checksums
7df7b13464a0b91eeff34c7ffe4f2793f3d4e097e2a9557acc7870cb5ab46ab9
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.0.8 This release

2 release files

0.0.7

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page