I'm using Python 3.7. I'm trying to make a CURL POST request using PyCurl , but I'm having trouble figuring out how to assemble the form parameters. I tried this
conn = pycurl.Curl()
if python3:
conn.setopt(conn.CAINFO, certifi.where())
conn.setopt(conn.URL, str(SEARCH_URL))
send = [("MAX_FILE_SIZE", 10485760),
('url', image_url),
('search', 'search'),
('nsfwfilter', 'on'),]
conn.setopt(pycurl.HTTPPOST, send)
conn.setopt(conn.FOLLOWLOCATION, 1)
conn.setopt(conn.USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0')
conn.setopt(conn.WRITEFUNCTION, returned_code.write)
conn.perform()
conn.close()
This dies with the error
File "/Users/davea/Documents/workspace/myproject_project/myproject/services/media_service.py", line 71, in doImageSearch
conn.setopt(pycurl.HTTPPOST, send)
TypeError: unsupported second type in tuple
How do I properly format the parametesr?