Example #1
0
def simple_request():
    url = request.GET.get('url', '').strip()
    if url!="":
	    candidateTags=fabicon.getCandidateTags(url)
	    output = template('icons', { "candidateTags" : candidateTags, "url" : url})

    return output
Example #2
0
def json_request():
    url = request.GET.get('url', '').strip()
    if url!="":
	    candidateTags=fabicon.getCandidateTags(url)
	    output = json.dumps({ "url" : url, "candidateTags" : candidateTags}, sort_keys=True, indent=4)

    return output
Example #3
0
    def testCandidateTags(self):
        for url, htmlFile, expectedResult in self.knownResults:

            resultsAreEqual.description = 'getCandidateTags give expected results for %s' % url

            script_full_path = os.path.realpath(__file__)
            script_dir = os.path.dirname(script_full_path)
            f = open(script_dir + "/resources/statichtml/"+htmlFile, 'r')
            staticHtml = f.read()

            candidateTags = getCandidateTags(url, staticHtml=staticHtml)

            yield resultsAreEqual, url, candidateTags, expectedResult