/ Published in: Python

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
def getFollowers(): #urlä½œæˆ followers=[] url = 'http://twitter.com/statuses/followers.xml' print >>sys.stderr,url base64string =b64encode("%s:%s" % (username, password)) headers = {"Authorization": "Basic %s" % base64string} xml_result=urlfetch.fetch(url, payload='', method=urlfetch.POST, headers=headers).content for soup in BeautifulSoup(xml_result)('screen_name'): #print >>sys.stderr,soup(text = True)[0] followers.append(soup(text = True)[0]) return followers
Comments
