old_contents: # Fiend - A Python module for accessing Zynga's Words with Friends
  # Copyright (C) 2011 Jahn Veach <v64@v64.net>
  # 
  # This program is free software: you can redistribute it and/or modify
  # it under the terms of the GNU General Public License as published by
  # the Free Software Foundation, either version 3 of the License, or
  # (at your option) any later version.
  # 
  # This program is distributed in the hope that it will be useful,
  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  # GNU General Public License for more details.
  #
  # You should have received a copy of the GNU General Public License
  # along with this program.  If not, see <http://www.gnu.org/licenses/>.
  
  import httplib2
  httplib2.debuglevel = 1
  
  import xml.etree.ElementTree as etree
  
  USER_AGENT = 'WordsWithFriendsAndroid/3.51'
  DEVICE_OS = '2.3.3'
  DEVICE_ID = 'ADR6300'
  
  class Fiend:
      def __init__(self, authorization, userAgent=USER_AGENT, deviceOs=DEVICE_OS, deviceId=DEVICE_ID):
          self.authorization = authorization
          self.userAgent = userAgent
          self.deviceOs = deviceOs
          self.deviceId = deviceId
  
          self.http = httplib2.Http();
  
      def getGames(self):
          params = {'game_type': 'WordGame', 'include_invitations': 'true', 'games_since': '1970-0-1T0:0:0-00:00', 'moves_since': '0', 'chat_messages_since': '0', 'get_current_user': 'true'}
          data = self.serverGet('games', params)
          tree = etree.parse(data)
  
          gamesData = {}
          games = tree.getroot()
          for game in games:
              pass
  
          return gamesData
  
      # Internal methods
      def serverGet(self, call, params):
          url = self.makeUrl(call, params)
          headers = {'User-Agent': USER_AGENT, 'Content-Type': 'application/xml', 'Authorization': self.authorization, 'Device-OS': self.deviceOs, 'Device-Id': self.deviceId, 'Accept': 'text/xml', 'Cache-Control': 'no-cache', 'Pragma': 'no-cache'}
          response, content = self.http.request(url, headers=headers)
  
          # TODO: Check response to make sure all is well
          return content
  
      def makeUrl(self, call, params):
          WWF_URL = 'https://wordswithfriends.zyngawithfriends.com/'
          url = WWF_URL + call + '?'
          url += '&'.join([str(k) + '=' + str(v) for k, v in params.iteritems()])
          return url
  
  
new_contents: # Fiend - A Python module for accessing Zynga's Words with Friends
  # Copyright (C) 2011 Jahn Veach <v64@v64.net>
  # 
  # This program is free software: you can redistribute it and/or modify
  # it under the terms of the GNU General Public License as published by
  # the Free Software Foundation, either version 3 of the License, or
  # (at your option) any later version.
  # 
  # This program is distributed in the hope that it will be useful,
  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  # GNU General Public License for more details.
  #
  # You should have received a copy of the GNU General Public License
  # along with this program.  If not, see <http://www.gnu.org/licenses/>.
  
  import httplib2
  httplib2.debuglevel = 1
  
  import xml.etree.ElementTree as etree
  
  USER_AGENT = 'WordsWithFriendsAndroid/3.51'
  DEVICE_OS = '2.3.3'
  DEVICE_ID = 'ADR6300'
  
  class Fiend(object):
      def __init__(self, authorization, userAgent=USER_AGENT, deviceOs=DEVICE_OS, deviceId=DEVICE_ID):
          self.authorization = authorization
          self.userAgent = userAgent
          self.deviceOs = deviceOs
          self.deviceId = deviceId
  
          self.http = httplib2.Http();
  
          self._gamesData = {}
  
      @property
      def gamesData(self):
          """Data about your games"""
          if not self._gamesData:
              self.refreshGamesData()
  
          return self._gamesData
  
      def refreshGamesData(self):
          params = {'game_type': 'WordGame', 'include_invitations': 'true', 'games_since': '1970-0-1T0:0:0-00:00', 'moves_since': '0', 'chat_messages_since': '0', 'get_current_user': 'true'}
          data = self.serverGet('games', params)
          games = etree.fromstring(data)
  
          for game in games:
              pass
  
      # Internal methods
      def serverGet(self, call, params):
          url = self.makeUrl(call, params)
          headers = {'User-Agent': USER_AGENT, 'Content-Type': 'application/xml', 'Authorization': self.authorization, 'Device-OS': self.deviceOs, 'Device-Id': self.deviceId, 'Accept': 'text/xml', 'Cache-Control': 'no-cache', 'Pragma': 'no-cache'}
          response, content = self.http.request(url, headers=headers)
  
          # TODO: Check response to make sure all is well
          return content
  
      def makeUrl(self, call, params):
          WWF_URL = 'https://wordswithfriends.zyngawithfriends.com/'
          url = WWF_URL + call + '?'
          url += '&'.join([str(k) + '=' + str(v) for k, v in params.iteritems()])
          return url
  
subject: make gamesData a lazy loaded property