FIX: Stopped the parser from printing all data from the starttag, turns out o forgot to reset the variable when it encounters the endtag... *facepalm
This commit is contained in:
parent
cb706839bc
commit
f230a5bb80
13
HTTPy.py
13
HTTPy.py
@ -12,17 +12,24 @@ class MyHTMLParser(HTMLParser):
|
||||
global conf_temp
|
||||
global starttag
|
||||
if tag == conf_temp:
|
||||
# starttag = tag
|
||||
for name, value in attrs:
|
||||
if name == "class" and value == "df-raw":
|
||||
print tag
|
||||
starttag = tag
|
||||
pass
|
||||
starttag = tag
|
||||
# pass
|
||||
#print starttag
|
||||
|
||||
def handle_endtag(self, tag):
|
||||
global starttag
|
||||
if tag == "pre":
|
||||
starttag = ""
|
||||
|
||||
def handle_data(self, data):
|
||||
#print starttag
|
||||
if starttag == conf_temp:
|
||||
print data
|
||||
pass
|
||||
|
||||
|
||||
|
||||
conn = httplib.HTTPSConnection("www.whois.com")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user