Attachment 'TwitterStock_Version4.py'
Download 1 import urllib, urllib2, base64
2
3 def __on_twitter_account_changed(self):
4 ...
5 authenticated = False
6
7 if self.__twitter_account.GetPassword() != "":
8 auth = base64.encodestring("%s:%s" % (self.__twitter_account.GetUsername(), self.__twitter_account.GetPassword())).strip()
9 try:
10 handle = urllib2.urlopen(urllib2.Request("http://twitter.com/account/verify_credentials.json", \
11 urllib.urlencode({}), {"Authorization": "Basic %s" % auth}))
12 if handle.code == 200:
13 authenticated = True
14 except urllib2.HTTPError, e:
15 # if the credentials are bad we'll get 401 error code
16 _logger.debug("e.code is %s" % str(e.code))
17
18 if not authenticated:
19 self.__box.append(self.__login_button)
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.