antimatter.client.rest#

Antimatter Public API

Interact with the Antimatter Cloud API

The version of the OpenAPI document: 1.1.3 Contact: support@antimatter.io Generated by OpenAPI Generator (https://openapi-generator.tech)

Do not edit the class manually.

Module Contents#

Classes#

RESTResponse

The abstract base class for all I/O classes.

RESTClientObject

Functions#

Attributes#

antimatter.client.rest.SUPPORTED_SOCKS_PROXIES#
antimatter.client.rest.RESTResponseType#
antimatter.client.rest.is_socks_proxy_url(url)#
class antimatter.client.rest.RESTResponse(resp)#

Bases: io.IOBase

The abstract base class for all I/O classes.

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!’)

class closed#
read()#
getheaders()#

Returns a dictionary of the response headers.

getheader(name, default=None)#

Returns a given response header.

close()#

Flush and close the IO object.

This method has no effect if the file is already closed.

fileno()#

Returns underlying file descriptor if one exists.

OSError is raised if the IO object does not use a file descriptor.

flush()#

Flush write buffers, if applicable.

This is not implemented for read-only and non-blocking streams.

isatty()#

Return whether this is an ‘interactive’ stream.

Return False if it can’t be determined.

readable()#

Return whether object was opened for reading.

If False, read() will raise OSError.

readline()#

Read and return a line from the stream.

If size is specified, at most size bytes will be read.

The line terminator is always b’n’ for binary files; for text files, the newlines argument to open can be used to select the line terminator(s) recognized.

readlines()#

Return a list of lines from the stream.

hint can be specified to control the number of lines read: no more lines will be read if the total size (in bytes/characters) of all lines so far exceeds hint.

seek()#

Change the stream position to the given byte offset.

offset

The stream position, relative to ‘whence’.

whence

The relative position to seek from.

The offset is interpreted relative to the position indicated by whence. Values for whence are:

  • os.SEEK_SET or 0 – start of stream (the default); offset should be zero or positive

  • os.SEEK_CUR or 1 – current stream position; offset may be negative

  • os.SEEK_END or 2 – end of stream; offset is usually negative

Return the new absolute position.

seekable()#

Return whether object supports random access.

If False, seek(), tell() and truncate() will raise OSError. This method may need to do a test seek().

tell()#

Return current stream position.

truncate()#

Truncate file to size bytes.

File pointer is left unchanged. Size defaults to the current IO position as reported by tell(). Returns the new size.

writable()#

Return whether object was opened for writing.

If False, write() will raise OSError.

writelines()#

Write a list of lines to stream.

Line separators are not added, so it is usual for each of the lines provided to have a line separator at the end.

class antimatter.client.rest.RESTClientObject(configuration)#
request(method, url, headers=None, body=None, post_params=None, _request_timeout=None)#

Perform requests.

Parameters:
  • method – http request method

  • url – http request 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

  • _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.