python syntax

  • From: "Alex Hall" <mehgcap@xxxxxxxxx>
  • To: "Blind Programming List" <programmingblind@xxxxxxxxxxxxx>
  • Date: Sun, 27 Dec 2009 13:37:49 -0500

Hi all,
I am really trying to better understand Python, but I am lost here. I have a file called pyfacebook, and it is a python wrapper for the facebook api. I am trying to add a ocuple of my own methods to this file, the new stream methods. I want all these methods in one class, so I created said class. Now, though, I am not sure how to put my methods into my class. The file contains something called an IDL, which seems to be a dictionary of methods? The other problem I have is getting some necessary information for connecting to facebook in the first place. Most of it can be gotten through methods already in place, but I am not sure how to call one such method because it has a lot of use of the word 'self' and I am unable to figure out just what it returns. I have pasted this funciton below. If you understand it, could you please explain it!!?? Thanks.

   def getSession(self):
"""Facebook API call. See http://developers.facebook.com/documentation.php?v=1.0&method=auth.getSession""";
       args = {}
       try:
           args['auth_token'] = self._client.auth_token
       except AttributeError:
           raise RuntimeError('Client does not have auth_token set.')
       result = self._client('%s.getSession' % self._name, args)
       self._client.session_key = result['session_key']
       self._client.uid = result['uid']
       self._client.secret = result.get('secret')
       self._client.session_key_expires = result['expires']
       return result


Have a great day,
Alex
New email address: mehgcap@xxxxxxxxx
__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: