def GetInfofromRS(self, con): b = RSInfoParser() url = "http://www.retrosheet.org/boxesetc/%s/P%s.htm" % (self.rsuserid[0].upper(), self.rsuserid) html = urllib2.urlopen(url).read().decode('utf-8') b.feed(html) cur = con.cursor() key = self.GetPitcherKey(con) sql = 'UPDATE "PITCHER_STATS" SET "HEIGHT_INCH" = %s, "WEIGHT_LBS" = %s, "BIRTH_DATE"=\'%s\', "MLB_DEBUT_DATE"=\'%s\', "THROW_HAND"=\'%s\' WHERE "PLAYER_KEY" = %s' % ( b.height, b.weight, b.birthDate.strftime('%Y-%m-%d'), b.debutDate.strftime('%Y-%m-%d'), b.throwHand, key) cur.execute(sql) cur.execute('COMMIT;')
def GetInfofromRS(self, con): b = RSInfoParser() url = "http://www.retrosheet.org/boxesetc/%s/P%s.htm" % (self.rsuserid[0].upper(), self.rsuserid) html = urllib2.urlopen(url).read().encode('utf-8').replace('·', '*') b.feed(html) cur = con.cursor() key = self.GetHitterKey(con) if key > 0: sql = 'UPDATE "HITTER_STATS" SET "HEIGHT_INCH" = %s, "WEIGHT_LBS" = %s, ' \ '"BIRTH_DATE"=\'%s\', "MLB_DEBUT_DATE"=\'%s\', "BAT_HAND"=\'%s\' ' \ 'WHERE "PLAYER_KEY" = %s' % \ (b.height, b.weight, b.birthDate.strftime('%Y-%m-%d'), b.debutDate.strftime('%Y-%m-%d'), b.batHand, key) cur.execute(sql) cur.execute('COMMIT;') return True else: return False