Code Monkey home page Code Monkey logo

Comments (4)

bstoilov avatar bstoilov commented on June 6, 2024

Never tested that, if you do to many requests from one ip the account will be locked for 24 hours.
You need to use proxies, as for the max limit of invites there is no official data

from py3-pinterest.

austkel avatar austkel commented on June 6, 2024

How would I even begin to write the command though?

from py3-pinterest.

bstoilov avatar bstoilov commented on June 6, 2024

You need two things before you can start inviting.

  1. Board data for the board you will invite people to.
  2. List of users you want to invite

The board can be obtained in the following way.

boards = []
board_batch = pinterest.boards()
while len(board_batch) > 0:
    boards += board_batch
    board_batch = pinterest.boards()

board = boards[0]

In this case I picked the first board but you can pick any you like.

Next we need a list of user id to invite.
You can do this in many ways, I would do it using the search method.
Due to recent changes in the pinterest api, you can't search directly for users, instead you have to search for pins or boards and from there extract owners and pinners.
Here is a example code for the pins case:

results = []
max_results = 100
search_batch = pinterest.search(scope='boards', query='food', page_size=50)
while len(search_batch) > 0 and len(results) < max_results:
    results += search_batch
    pinterest.search(scope='pins', query='food', page_size=50)

target_users = []
for s in results:
    target_users.append(s['owner'])

Now in target users you have a list of size 'max_results' with users.
You can specify different query.
If you have other means of extracting user ids that is ok you just need python array with ids.

The final step is to invite the users which is straight forward:

for user in target_users:
    pinterest.invite(board_id=board['id'], board_url=board['url'], user_id=user['id'])

I found problems with the documentation and examples.py related to this issue which I will update.

from py3-pinterest.

bstoilov avatar bstoilov commented on June 6, 2024

I committed a file with the full code

https://github.com/bstoilov/py3-pinterest/blob/master/mass_board_invites.py

from py3-pinterest.

Related Issues (20)

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.