from twython import Twython
APP_KEY = 'YOUR_APP_KEY'
language: python | |
python: | |
- 2.6 | |
- 2.7 | |
- 3.4 | |
env: | |
- DJANGO_VERSION=1.4.20 | |
- DJANGO_VERSION=1.5.12 | |
- DJANGO_VERSION=1.6.11 | |
- DJANGO_VERSION=1.7.8 |
{ | |
u'error': [{ | |
u'category': u'Application', | |
u'domain': u'PLATFORM', | |
u'errorId': u'580001', | |
u'message': u'Invalid request: {0}', | |
u'severity': u'Error', | |
u'subdomain': u'Application' | |
}], | |
u'responseEnvelope': { |
[{ | |
u 'name': u 'Worldwide', | |
u 'countryCode': None, | |
u 'url': u 'http://where.yahooapis.com/v1/place/1', | |
u 'country': u '', | |
u 'parentid': 0, | |
u 'placeType': { | |
u 'code': 19, | |
u 'name': u 'Supername' | |
}, |
import requests | |
from requests_oauthlib import OAuth1 | |
import json | |
ITER_CHUNK_SIZE = 512 | |
def iter_lines(response, chunk_size=ITER_CHUNK_SIZE, decode_unicode=None): | |
"""Iterates over the response data, one line at a time. When | |
stream=True is set on the request, this avoids reading the | |
content at once into memory for large responses. |
ITER_CHUNK_SIZE = 512 | |
def iter_lines(response, chunk_size=ITER_CHUNK_SIZE, decode_unicode=None): | |
"""Iterates over the response data, one line at a time. When | |
stream=True is set on the request, this avoids reading the | |
content at once into memory for large responses. | |
""" | |
pending = None |
from twython import TwythonStreamer | |
class MyStreamer(TwythonStreamer): | |
def on_success(self, data): | |
if 'text' in data: | |
print (data['text'].encode('utf-8')) | |
def on_error(self, status_code, data): | |
print (status_code, data) | |
stream = MyStreamer(APP_KEY, APP_SECRET, |
import requests | |
from requests_oauthlib import OAuth1 | |
import json | |
auth = OAuth1(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET) | |
client = requests.Session() | |
client.auth = auth | |
client.stream = True | |
response = client.post('https://stream.twitter.com/1.1/statuses/filter.json', data={'track': '@mikehelmick'}) |
export PATH="$HOME/bin:$PATH" | |
export WORKON_HOME=~/.virtualenv | |
source /usr/local/bin/virtualenvwrapper.sh |
"\e[A": history-search-backward | |
"\e[B": history-search-forward | |
set show-all-if-ambiguous on | |
set completion-ignore-case on |