0

I need to pass an amazon s3 signed URL to my python cURL function. The signed url have some special characters as '%' which is passed to the cURL POSTFIELDS and after the processing I am getting 500 Internal Server error. Is there a way to pass the POSTFIELDS in encoded format so cURL can process it?

Dipanwita Das
  • 329
  • 2
  • 6
  • 15

1 Answers1

1
import urllib
import pycurl

def urlconvert:
  wrapper = {'filename':p} # p is the amazon s3 signed url
  c = pycurl.Curl()
  c.setopt(pycurl.URL, url) #url is the url for curl request
  c.setopt(pycurl.POST, 1)
  post_args = urllib.urlencode(wrapper)
  c.setopt(pycurl.POSTFIELDS, post_args)
Dipanwita Das
  • 329
  • 2
  • 6
  • 15