academic_observatory_api.client.rest

Academic Observatory API

The REST API for accessing data from academic-observatory-workflows. # noqa: E501

The version of the OpenAPI document: 1.0.0 Contact: agent@observatory.academy Generated by: https://openapi-generator.tech

Module Contents

Classes

RESTResponse

The abstract base class for all I/O classes, acting on streams of

RESTClientObject

Functions

is_ipv4(target)

Test if IPv4 address or not

in_ipv4net(target, net)

Test if target belongs to given IPv4 network

should_bypass_proxies(url, no_proxy=None)

Yet another requests.should_bypass_proxies

Attributes

logger

academic_observatory_api.client.rest.logger[source]
class academic_observatory_api.client.rest.RESTResponse(resp)[source]

Bases: io.IOBase

The abstract base class for all I/O classes, acting on streams of bytes. There is no public constructor.

This class provides dummy implementations for many methods that derived classes can override selectively; the default implementations represent a file that cannot be read, written or seeked.

Even though IOBase does not declare read, readinto, or write because their signatures will vary, implementations and clients should consider those methods part of the interface. Also, implementations may raise UnsupportedOperation when operations they do not support are called.

The basic type used for binary data read from or written to a file is bytes. Other bytes-like objects are accepted as method arguments too. In some cases (such as readinto), a writable object is required. Text I/O classes work with str data.

Note that calling any method (except additional calls to close(), which are ignored) on a closed stream should raise a ValueError.

IOBase (and its subclasses) support the iterator protocol, meaning that an IOBase object can be iterated over yielding the lines in a stream.

IOBase also supports the with statement. In this example, fp is closed after the suite of the with statement is complete:

with open(‘spam.txt’, ‘r’) as fp:

fp.write(‘Spam and eggs!’)

getheaders(self)[source]

Returns a dictionary of the response headers.

getheader(self, name, default=None)[source]

Returns a given response header.

class academic_observatory_api.client.rest.RESTClientObject(configuration, pools_size=4, maxsize=None)[source]

Bases: object

request(self, method, url, query_params=None, headers=None, body=None, post_params=None, _preload_content=True, _request_timeout=None)[source]

Perform requests.

Parameters
  • method – http request method

  • url – http request url

  • query_params – query parameters in the url

  • headers – http request headers

  • body – request json body, for application/json

  • post_params – request post parameters, application/x-www-form-urlencoded and multipart/form-data

  • _preload_content – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.

  • _request_timeout – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.

GET(self, url, headers=None, query_params=None, _preload_content=True, _request_timeout=None)[source]
HEAD(self, url, headers=None, query_params=None, _preload_content=True, _request_timeout=None)[source]
OPTIONS(self, url, headers=None, query_params=None, post_params=None, body=None, _preload_content=True, _request_timeout=None)[source]
DELETE(self, url, headers=None, query_params=None, body=None, _preload_content=True, _request_timeout=None)[source]
POST(self, url, headers=None, query_params=None, post_params=None, body=None, _preload_content=True, _request_timeout=None)[source]
PUT(self, url, headers=None, query_params=None, post_params=None, body=None, _preload_content=True, _request_timeout=None)[source]
PATCH(self, url, headers=None, query_params=None, post_params=None, body=None, _preload_content=True, _request_timeout=None)[source]
academic_observatory_api.client.rest.is_ipv4(target)[source]

Test if IPv4 address or not

academic_observatory_api.client.rest.in_ipv4net(target, net)[source]

Test if target belongs to given IPv4 network

academic_observatory_api.client.rest.should_bypass_proxies(url, no_proxy=None)[source]

Yet another requests.should_bypass_proxies Test if proxies should not be used for a particular url.