Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IP address banned due to suspected abuse #69

Closed
EliseBIBS opened this issue Jun 1, 2016 · 3 comments
Closed

IP address banned due to suspected abuse #69

EliseBIBS opened this issue Jun 1, 2016 · 3 comments

Comments

@EliseBIBS
Copy link

Hello everybody,

I'm importing data in our REDCap server.
For the third time, my ip address was banned from REDCap.
However, I'm importing just a few data (like 20 records).
Did someone had the same issue ?
Thanks

@dgutman
Copy link

dgutman commented Jun 1, 2016

Heh--- so I've had this problem and it's annoying.... It's not the
number of records, it's the number of requests per second.... were you
trying to submit 20 batches of 1 record? I've had to put in a rate
limiter in the past.... and also try and submit batches of records (i.e.
a list of dictionaries) ..

On Wed, Jun 1, 2016 at 7:13 AM EliseBIBS notifications@github.com wrote:

Hello everybody,

I'm importing data in our REDCap server.
For the third time, my ip address was banned from REDCap.
However, I'm importing just a few data (like 20 records).
Did someone had the same issue ?
Thanks


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#69, or mute the thread
https://github.com/notifications/unsubscribe/AArhzshyC1aCbWXs8TsIuDBFa54E830Kks5qHWlBgaJpZM4Irb5p
.

David A Gutman MD PhD
Assistant Professor of Neurology, Psychiatry & Biomedical Informatics
Emory University School of Medicine
Staff Physician, Mental Health Service Line
Atlanta VA Medical Center

@sburns
Copy link
Collaborator

sburns commented Jun 2, 2016

Hi Elise,

I agree with David here. Your code might be doing something like this...

project = Project(URL, TOKEN)
# compute a list of records to import
data_to_import = do_science()
for record in data_to_import:
    project.import_records([record])

# But you should do something more like
project.import_records(data_to_import)

In the first part, what ends up happening underneath the hood is that pycap will issue a separate HTTP request each time you call .import_records. This isn't bad in and of itself, but if you're doing this within a tight loop like this, this kind of HTTP traffic going to the REDCap server looks like spam, nefarious users or something else that's generally bad. Your REDCap admins seem to have some infrastructure in place to ban IP that make too many requests too quickly.

In the second part, since we only call .import_records once, only a single HTTP request is made though it carries substantially more data with it.

Hope this helps. If you find more issues, please include your code or a representative snippet (but please strip any tokens before pasting 😄 ) and we'd be more than welcome to help.

@EliseBIBS
Copy link
Author

Hi !
I changed my code. It makes a list of dictionnaries of the data to import and call import_record once
It solved my issue !
Thanks to you both :)

@sburns sburns closed this as completed Jun 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants