Bulk Upload / Download?

18 views
Skip to first unread message

adastra22

unread,
Mar 19, 2018, 10:06:52 AM3/19/18
to crits-users
Hello there,

I have several custom Python scripts that I use to upload and download indicators from CRITs. As we add more and more indicators, I'm noticing the performance of my scripts drop dramatically. I was wondering if there was a way to upload or download multiple indicators with one POST or GET request. 

My code for downloading - 

for obj in crits.indicators():

My code for uploading - 

with open(upload_file) as csvfile:
   reader = csv.DictReader(csvfile)
   for row in reader:
      data = {
         <stripped>
      }

      r = requests.post(api_url, data=data, verify=False)
      if r.status_code == 200:
         print("200 status code for indicator - {}".format(row['value']))
         print('{}'.format(r.text))
      else:
         print("Error with status code {} and message {}".format(r.status_code, r.text))

Thank you!
Reply all
Reply to author
Forward
0 new messages