move-coop / parsons

A python library of connectors for the progressive community.
https://www.parsonsproject.org/
Other
258 stars 128 forks source link

[Bug] NewMode Connector rate limit #883

Open stchessidy opened 11 months ago

stchessidy commented 11 months ago

When I try to use the get_outreach() more than 30 times (in a loop) I get a CSRF Token error, potentially suggesting a limit to the number of consecutive calls that can be made.

Detailed Description

In my example code below if I give it a list of 100 outreach_ids, i'd expect it to return all the associated target_ids. But it's breaking after the 29th loop. The error message that I am getting is:

Screen Shot 2023-08-28 at 1 07 58 PM

I think the 'NoneType' error is a red herring because If I run the 30th outreach_id on it's own I get the expected results.

I should also add that switching from using the Parsons connector to using the functions/class in Canales fixed my issue.

To Reproduce

Example code that I was trying to run.

from Parsons import Newmode

def get_target_id(outreach_id):
  newmode = Newmode()

  target_id_list = []

  for x in outreach_id:
      data = dict()
      data['outreach_id'] = x
      data['targets'] = newmode.get_outreach(x)['targets']
      target_id_list.append(data)

  return target_id_list

Your Environment

Additional Context

Add any other context about the problem here.

Priority

Low priority, as I said, using the Canales NewMode code instead allowed me to do what I needed to do