This file contains hidden or 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 urllib2 | |
import simplejson | |
import re | |
import requests | |
from bs4 import BeautifulSoup | |
from random import choice | |
# The request also includes the userip parameter which provides the end | |
# user's IP address. Doing so will help distinguish this legitimate |
This file contains hidden or 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 urllib | |
import json | |
resp = urllib.urlopen("https://api.twitter.com/1/statuses/user_timeline.json?screen_name=foxnews&count=200") | |
tweets = json.loads(resp.read()) | |
for tweet in tweets: | |
print tweet['text'] |
This file contains hidden or 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
.africa | |
Aarktica | |
Ablephica | |
Academica | |
Académica | |
Acaenica | |
Acalica | |
Acanthodica | |
Acelica | |
Acoustica |
This file contains hidden or 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
# return a random sample of your twitter followers | |
# run like so: | |
# $ python random_followers.py <screen_name> | |
# where <screen_name> is the account you want followers for | |
import sys, random, json, urllib | |
sname = sys.argv[1] | |
ids_raw = urllib.urlopen( | |
"https://api.twitter.com/1/followers/ids.json?screen_name="+sname).read() |
This file contains hidden or 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
ajar-n-b | |
almodovar-n-b | |
babar-n-b | |
bazaar-n-b | |
dan bejar-n-b | |
bizarre-n-b | |
car-n-b | |
cigar-n-b | |
czar-n-b | |
côte-d'ivoire-n-b |
This file contains hidden or 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
# Run on the command line like so: | |
# $ python your_consumer_key your_consumer_secret your_access_token your_token_secret | |
import requests | |
from requests.auth import OAuth1 | |
import sys | |
consumer_key, consumer_secret, access_token, token_secret = \ | |
[unicode(x) for x in sys.argv[1:]] |
This file contains hidden or 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
# simple tornado app that implements fitbit oauth login. | |
# requires tornado 2.4-ish. run on the command line like so: | |
# $ python fitbit_auth_example.py --port=<your port> \ | |
# --fitbit_consumer_key=<your consumer key> \ | |
# --fitbit_consumer_secret=<your consumer secret> | |
# | |
# make sure to set your fitbit app's callback URL to | |
# http://your-app-url.example.com/login | |
import tornado.web |
This file contains hidden or 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
# an interactive python script to assist in getting access tokens for OAuth v1 | |
# APIs. requires python's OAuth2 library (pip install oauth2) | |
# | |
# run from the command line like so: | |
# | |
# $ python three_legged_oauth_helper.py --consumer_key=<ckey> \ | |
# --consumer_secret=<csecret> \ | |
# --request_token_url=<request_token_url> \ | |
# --authorize_url=<authorize_url> \ | |
# --access_token_url=<access_token_url> |
This file contains hidden or 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
# fetch an access token for a Facebook application | |
# | |
# run like so: | |
# | |
# $ python facebook_app_token.py --app_id=<your app id> --secret=<your secret> | |
# | |
# ... where <your app id> is your Facebook application ID, and <your secret> | |
# is the application secret for that application (both can be retrieved from | |
# the Facebook developer app) |
This file contains hidden or 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 sys | |
concordance = dict() | |
for line in sys.stdin: | |
line = line.strip() | |
line_words = line.split(" ") | |
for word in line_words: | |
if word in concordance: | |
concordance[word].append(line) |