Giter Club home page Giter Club logo

python-pinterest-api's Introduction

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

python-pinterest-api's People

Contributors

bryand1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

python-pinterest-api's Issues

Not working anymore

Followed the example but received the following error:

pinterest.err.PinterestHttpException: PinterestHttpException: [404] https://api.pinterest.com/v1/me/?access_token=access_token&fields=first_name%2Clast_name%2Cid%2Curl  

Note that access_token should be the correct one.

Module "pinterest" has no attribute "oauth2"

Hey there,

Unfortunately, having an issue with Pinterest-API. I installed it via PIP and attempted to run the very first few lines to test a login and got an error on the very first line.
link = pinterest.oauth2.authorization_url(clientID, "https://www.geekoverdrivestudio.com") AttributeError: module 'pinterest' has no attribute 'oauth2'

Really hoping this is caused by something I overlooked.

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.