Example #1
0
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
Example #2
0
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)
   
elif not res and kind == 3:
   print "<h2>We haven't found any url with all these features ",feats,"yet!</h2>"
elif not res and kind == 1:
   print "<h2>What?!</h2>"
else :
   print "<table border='1'>"