I want to execute a curl command in python.
curl -d @request.json --header "Content-Type: application/json"
https://www.googleapis.com/qpxExpress/v1/trips/search?key=mykeyhere
There is a request.json file to be sent to get response. I tried to write code, but it does not work.
import pycurl
import StringIO
response = StringIO.StringIO()
c = pycurl.Curl()
c.setopt(c.URL, '
https://www.googleapis.com/qpxExpress/v1/trips/search?key=mykeyhere')
c.setopt(c.WRITEFUNCTION, response.write)
c.setopt(c.HTTPHEADER, ['Content-Type: application/json','Accept-Charset: UTF-8'])
c.setopt(c.POSTFIELDS, '@request.json')
c.perform()
c.close()
print response.getvalue()
response.close()
The error message is 'Parse Error'. Help me fix it.
Select the correct answer from above options
questions and answers, questions pdf, question bank, questions and answers pdf, mcq on pdf, questions and solutions, mcq Test , Interview questions, Questions for Interview, MCQ (Multiple Choice Questions),Core Questions, Core Hadoop MCQ,core interview questions for experienced