Added basic parsing code
This commit is contained in:
parent
961de708e3
commit
aba8f7ddb9
14
HTTPy.py
14
HTTPy.py
@ -1,8 +1,18 @@
|
|||||||
#!/bin/python2.7
|
#!/bin/python2.7
|
||||||
|
from HTMLParser import HTMLParser
|
||||||
import httplib
|
import httplib
|
||||||
|
|
||||||
|
starttag = ""
|
||||||
|
|
||||||
|
class HTMLParse(HTMLParser):
|
||||||
|
def handle_starttag(self, tag, attrs):
|
||||||
|
starttag = tag
|
||||||
|
print starttag
|
||||||
|
|
||||||
|
|
||||||
conn = httplib.HTTPSConnection("www.python.org")
|
conn = httplib.HTTPSConnection("www.python.org")
|
||||||
conn.request("GET", "/")
|
conn.request("GET", "/")
|
||||||
r1 = conn.getresponse()
|
r1 = conn.getresponse()
|
||||||
|
parser = HTMLParse
|
||||||
|
|
||||||
print r1.read()
|
parser.feed(r1.read())
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user