Exemplo n.º 1
0
def translate(foreign):
    final_url = foreign.get('final_url')

    if final_url:
        return final_url
    else:
        endpoint = util.translate_endpoint( foreign['original_url'], foreign['foreign_url'])
        response = environment.json_from_url(endpoint)

        return util.translated_from(response)
Exemplo n.º 2
0
def translate(foreign):
    final_url = foreign.get('final_url')

    if final_url:
        return final_url
    else:
        endpoint = util.translate_endpoint(foreign['original_url'],
                                           foreign['foreign_url'])
        response = environment.json_from_url(endpoint)

        return util.translated_from(response)
Exemplo n.º 3
0
    def helper(self, args):
        default_params = {'url': self.url, 'page': self.markup}

        helper_url = util.listings_endpoint('/helpers')
        merged = dict(default_params, **args)
        compressed = zlib.compress(environment.json_from_object(merged), 9)
        params = {'payload': compressed}
        resp = environment.json_from_url(helper_url, params=params)

        if type(resp) is dict:
            self.proc.insert(0, resp)
        elif type(resp) is list:
            resp.reverse()
            for c in resp:
                self.proc.insert(0, c)

        return resp
Exemplo n.º 4
0
    def helper(self, args):
        default_params = {
            'url':  self.url,
            'page': self.markup
        }

        helper_url = util.listings_endpoint('/helpers')
        merged     = dict(default_params, **args)
        compressed = zlib.compress(environment.json_from_object(merged), 9)
        params     = { 'payload': compressed }
        resp       = environment.json_from_url(helper_url, params = params)

        if type(resp) is dict:
            self.proc.insert(0, resp)
        elif type(resp) is list:
            resp.reverse()
            for c in resp:
                self.proc.insert(0, c)

        return resp
Exemplo n.º 5
0
def all_procedures():
    return environment.json_from_url(util.procedures_endpoint(), expires = cache.TIME_DAY)
Exemplo n.º 6
0
def get_payload(endpoint):
    ttl = cache.TIME_HOUR / 2
    endpoint = util.sources_endpoint(endpoint)

    return environment.json_from_url(endpoint, expires=ttl)
Exemplo n.º 7
0
def get_payload(endpoint):
    ttl      = cache.TIME_HOUR / 2
    endpoint = util.sources_endpoint(endpoint)

    return environment.json_from_url(endpoint, expires = ttl)
Exemplo n.º 8
0
def all_procedures():
    return environment.json_from_url(util.procedures_endpoint(),
                                     expires=cache.TIME_DAY)