예제 #1
0
    def GET(self, brief_or_full, idtype, idval):
        i = web.input()

        web.ctx.headers = []
        req = '%s:%s' % (idtype, idval)
        result = readlinks.readlinks(req, i)
        if req in result:
            result = result[req]
        else:
            result = []
        return simplejson.dumps(result)
예제 #2
0
    def GET(self, brief_or_full, idtype, idval):
        i = web.input()

        web.ctx.headers = []
        req = f'{idtype}:{idval}'
        result = readlinks.readlinks(req, i)
        if req in result:
            result = result[req]
        else:
            result = []
        return json.dumps(result)
예제 #3
0
    def GET(self, brief_or_full, req):  # params aren't used, see below
        i = web.input()

        # Work around issue with gunicorn where semicolon and after
        # get truncated.  (web.input() still seems ok)
        # see https://github.com/benoitc/gunicorn/issues/215
        raw_uri = web.ctx.env.get("RAW_URI")
        if raw_uri:
            raw_path = urllib.parse.urlsplit(raw_uri).path

            # handle e.g. '%7C' for '|'
            decoded_path = urllib.parse.unquote(raw_path)

            m = self.path_re.match(decoded_path)
            if not len(m.groups()) == 2:
                return simplejson.dumps({})
            (brief_or_full, req) = m.groups()

        web.ctx.headers = []
        result = readlinks.readlinks(req, i)
        return simplejson.dumps(result)