Example #1
0
def async_related(add_call_list):

    url_list = []
    for related_id in add_call_list:
        url_list.append(urls.make_url(related_id[1]))
        url_list.append(urls.make_url(related_id[1], is_html=True))

    rs = (grequests.get(u) for u in url_list)
    responses = grequests.map(rs)

    return responses
Example #2
0
def async_response(id):

    response = {}

    url_list = [
        urls.make_url(id, is_html=True),
        urls.make_url(id, is_expanded=True),
        urls.make_url(id),
    ]

    rs = (grequests.get(u) for u in url_list)
    response_list = grequests.map(rs)

    response['wiki_html'] = response_list[0]
    response['wiki_expanded_html'] = response_list[1]
    response['wiki_text'] = response_list[2]

    return response
Example #3
0
def simple_request(id):

    return requests.get(urls.make_url(id))