Esempio n. 1
0
 def __init__(self, lcd, wait):
     PertBase.__init__(self, lcd, wait)
     # Load config stuff
     config = ConfigParser.SafeConfigParser()
     config.read(['config/eve.conf'])
     self.keyID = config.get("API", "ID")
     self.vCode = config.get("API", "VerificationCode")
     if PertModule.CharacterID is None:
         # We have to look all this fun stuff up, too.
         char_name = config.get("Character", "Name")
         chars = self.api_request("account/Characters")
         chars = chars.find("result").find("rowset").findall("row")
         for char in chars:
             if char.get('name').lower() == char_name.lower():
                 # We found it!
                 PertModule.CharacterName = char.get('name')
                 PertModule.CharacterID = int(char.get('characterID'))
                 PertModule.CorpID = int(char.get('corporationID'))
                 break
         if PertModule.CharacterID is None:
             return
     # Get the corp ticker
     corp = self.api_request("corp/CorporationSheet", corporationID=PertModule.CorpID)
     if corp is not None:
         PertModule.CorpTicker = corp.find('result').find('ticker').text
Esempio n. 2
0
 def __init__(self, lcd, wait):
     PertBase.__init__(self, lcd, wait)
     # Load config stuff
     config = ConfigParser.SafeConfigParser()
     config.read(['config/weather.conf'])
     self.location = config.get("Forecast", "Location")
     
     try:
         f = urllib2.urlopen("http://api.wunderground.com/auto/wui/geo/ForecastXML/index.xml?query=%s" % self.location, None, 3);
         xml = f.read()
         f.close()
         self.forecast = ET.XML(xml)
     except:
         self.lcd.display_string("Forecast retrieval failed.")
Esempio n. 3
0
 def __init__(self, lcd, wait):
     PertBase.__init__(self, lcd, wait)
     # Load config stuff
     config = ConfigParser.SafeConfigParser()
     config.read(['config/weather.conf'])
     self.station = config.get("Current", "Station")
     
     try:
         f = urllib2.urlopen("http://api.wunderground.com/weatherstation/WXCurrentObXML.asp?ID=%s" % self.station, None, 3)
         xml = f.read()
         f.close()
         self.weather = ET.XML(xml)
     except:
         self.lcd.display_string("Weather retrieval failed.")