-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtwtest.py
More file actions
24 lines (19 loc) · 672 Bytes
/
Copy pathtwtest.py
File metadata and controls
24 lines (19 loc) · 672 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import urllib.request, urllib.parse, urllib.error
from twurl import augment
import ssl
# https://apps.twitter.com/
# Create App and get the four strings, put them in hidden.py
print('* Calling Twitter...')
url = augment('https://api.twitter.com/1.1/statuses/user_timeline.json',
{'screen_name': 'drchuck', 'count': '2'})
print(url)
# Ignore SSL certificate errors
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
connection = urllib.request.urlopen(url, context=ctx)
data = connection.read()
print(data)
print ('======================================')
headers = dict(connection.getheaders())
print(headers)