0

My curl POST-request looks as follows:

curl -v -u 'user:password' -F 'username=user' -F 'listname=myTest' -F 'class=other' -F  'file=test.csv' 'https://url/function'

Now, I assumed that the file would show up in request.files and could be processed from there. However, request.files is empty. It does show up in request.form, which looks as follows:

ImmutableMultiDict([('username', 'user'), ('listname', 'myTest'), ('file', 'test.csv'), ('class', 'other')])

If I try to use it like

file = request.form['file'] 
file_format = file.filename.split('.')[-1]

I get the error

AttributeError: 'str' object has no attribute 'filename'

so obviously, not the file is stored there, but only the file name. How do I pass the file in curl so I can then use it in python?

LizzAlice
  • 598
  • 6
  • 16

0 Answers0