Created
November 14, 2017 08:11
-
-
Save AhnSeongHyun/ace0ae00ac0d4f06da1208e06304d7ef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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