Skip to content

Instantly share code, notes, and snippets.

@AhnSeongHyun
Created November 14, 2017 08:11
Show Gist options
  • Save AhnSeongHyun/ace0ae00ac0d4f06da1208e06304d7ef to your computer and use it in GitHub Desktop.
Save AhnSeongHyun/ace0ae00ac0d4f06da1208e06304d7ef to your computer and use it in GitHub Desktop.
import pycurl
import re
from StringIO import StringIO
buffer = StringIO()
c = pycurl.Curl()
c.setopt(c.URL, 'https://x.com/api/store/search')
c.setopt(c.POST, True)
c.setopt(c.SSL_VERIFYPEER, False)
c.setopt(pycurl.HTTPHEADER, [
'Content-type:application/json;charset=utf-8',
'Authorization: Basic YmVhdDpiZWF0X2FwcDswZWU4YTg0NjhmMmVjYjUzMzY2ZGM0MTA4NzUzZxxxxxxx',
'access-token: xxx'
])
#c.setopt(c.HEADERFUNCTION, header_function)
c.perform()
print('Status: %d' % c.getinfo(c.RESPONSE_CODE))
print('TOTAL_TIME: %f' % c.getinfo(c.TOTAL_TIME))
c.close()
body = buffer.getvalue()
print(body)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment