Commit 135ac60b by Ed Crewe

add in placeholder dom func

parent 03e1e79b
...@@ -53,14 +53,16 @@ def get_ticket(page, app_url): ...@@ -53,14 +53,16 @@ def get_ticket(page, app_url):
starts = [app_url,'?ticket='] starts = [app_url,'?ticket=']
return find_in_page(page, starts, '"') return find_in_page(page, starts, '"')
def find_in_dom(page, top, parent, child): def find_in_dom(page, nesting=['body','form']):
""" Use dom to get values from page """ """ Use dom to get values from page """
from xml.dom import minidom from xml.dom import minidom
dom = minidom.parseString(page) dom = minidom.parseString(page)
topdom = dom.getElementsByTagname(top)[0] for level in nesting:
return dom.getElementsByTagname(parent)[0]. try:
getElementsByTagname(child)[0]. dom = dom.getElementsByTagname(level)[0]
getAttribute('data') except:
break
return dom.getAttribute('data')
def find_in_page(page, starts, stop): def find_in_page(page, starts, stop):
""" Replace this with find_in_dom ? """ Replace this with find_in_dom ?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment