magpie.network

Module Contents

Functions

http_get

Perform an http GET method on the given URL.

http_get_json

Perform an http GET method on the given URL and return it as a JSON object.

API

magpie.network.http_get(url: str, headers=None) str[source]

Perform an http GET method on the given URL.

Tip

This can be run as a celery task

Parameters:
  • url – the given URL to fetch

  • headers – optional http headers to pass along the request

Returns:

the text content of the given URL

magpie.network.http_get_json(url: str, headers=None) magpie.network.JsonObject[source]

Perform an http GET method on the given URL and return it as a JSON object.

Tip

This can be run as a celery task

Parameters:
  • url – the given URL to fetch

  • headers – optional http headers to pass along the request

Returns:

a JSON object parsed from the content of the given URL