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.
  • [get | view] (2021-02-25 09:46:11, 450.6 KB) [[attachment:GUADEC-Presentation.odp]]
  • [get | view] (2021-02-25 09:46:11, 0.6 KB) [[attachment:HippoCanvasExample.txt]]
  • [get | view] (2021-02-25 09:46:11, 0.5 KB) [[attachment:TwitterStock_Version1.py]]
  • [get | view] (2021-02-25 09:46:11, 3.9 KB) [[attachment:TwitterStock_Version2.py]]
  • [get | view] (2021-02-25 09:46:11, 0.4 KB) [[attachment:TwitterStock_Version3.py]]
  • [get | view] (2021-02-25 09:46:11, 0.9 KB) [[attachment:TwitterStock_Version4.py]]
  • [get | view] (2021-02-25 09:46:11, 3.1 KB) [[attachment:TwitterStock_Version5.py]]
  • [get | view] (2021-02-25 09:46:11, 2.4 KB) [[attachment:TwitterStock_Version6.py]]
  • [get | view] (2021-02-25 09:46:11, 14.1 KB) [[attachment:TwitterStock_Version7.py]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.