Esempio n. 1
0
 def _parse_html(self,html):
     out = {}
     parser = HTMLTableParser()
     parser.feed(html)
     parser.close()
     p = parser.out
     #out['tables'] = p
     out['desc'] = p['table4'][0][0]
     last = p['table4'][0][1]
     p1 = 2 + last.index(':',6)
     p2 = last.index(' ',p1)
     #print(last)
     out['last'] = float(last[p1:p2])
     expire = p['table9'][0][1]
     p1 = 2 + expire.index(',',16)
     out['expire'] = expire[p1:]
     out['calls'] = self._parse_strike_table(p['table11'])
     out['puts'] = self._parse_strike_table(p['table15'])
     return out
Esempio n. 2
0
def get_url(url):
    http = urllib.request.Request(url=url,headers=theaders)
    html = urllib.request.urlopen(http).read().decode('utf-8')
    print(html)
    parser = HTMLTableParser()
    parser.feed(html)
    parser.close()
    return parser
Esempio n. 3
0
 def _parse_html(self, html):
     out = {}
     parser = HTMLTableParser()
     parser.feed(html)
     parser.close()
     p = parser.out
     #out['tables'] = p
     out['desc'] = p['table4'][0][0]
     last = p['table4'][0][1]
     p1 = 2 + last.index(':', 6)
     p2 = last.index(' ', p1)
     #print(last)
     out['last'] = float(last[p1:p2])
     expire = p['table9'][0][1]
     p1 = 2 + expire.index(',', 16)
     out['expire'] = expire[p1:]
     out['calls'] = self._parse_strike_table(p['table11'])
     out['puts'] = self._parse_strike_table(p['table15'])
     return out