def getthis(): url = request.forms.get('url') feats = request.forms.get('features') if not url and not feats : res = None elif url and not feats : res = mon.geturl(url) elif not url and feats : if type(feats) == str: feats = [feats] res = mon.getfeat(feats) else : res = mon.getres(url,feats) if not res: return {} return res
print "Content-type: text.html\r\n\r\n" print "" print "<html><head><title>" print "Output</title></head><body>" form = cgi.FieldStorage() url = form.getvalue("url") feats = form.getvalue("feature") kind = 0 if not url and not feats : kind = 1 res = None elif url and not feats : kind = 2 res = mon.geturl(url) elif not url and feats : kind = 3 if type(feats) == str: feats = [feats] #print feats res = mon.getfeat(feats) else : kind = 4 res = mon.getres(url,feats) if not res and (kind == 4 or kind == 2): print "<h2>We haven't crawled ",url,"yet!</h2>" print "<div> Please get back later </div>" mon.needtocrawl(url)