LOGSConnection

class LOGS.LOGSConnection.LOGSConnection(url, apiKey, use_internal=False, verbose=False, verify=True)[source]

Bases: object

Python class to access the LOGS web API

property apiKey: str
property apiUrl: str
checkServer()[source]

Check if server can be reached

Raises:

Exception – Server cannot be reached.

deleteEndpoint(endpoint, parameters={}, responseType=ResponseTypes.JSON, includeUrl=True)[source]

Connects to the API with DELETE access to given endpoint

Parameters:
  • endpoint (Union[str, int, Sequence[Union[str, int]]]) – Name of the endpoint (e.g. dataset/2/tracks)

  • params – Parameters to pass to the endpoint. Defaults to None.

  • mode – Convert result to this format. Defaults to None.

Returns:

The respose of the server and the error code.

deleteUrl(url, parameters={}, responseType=ResponseTypes.JSON, includeUrl=True)[source]

Generate full API URL with PUT body

Parameters:
  • url (str) – Specify an API url otherwise object internal is used. Defaults to None.

  • params – Parameters to pass to an PUT request as json body. Defaults to None.

  • mode – The return value is converted to the specified format. Defaults to “json”.

Returns:

The respose of the server and the error code.

getAPIUrl()[source]

Generate full API URL

Return type:

str

Returns:

The url of the connected LOGS API (e.g. https://logs.com/api/2.1)

getEndpoint(endpoint, parameters=None, responseType=ResponseTypes.JSON, includeUrl=True)[source]

Connects to the API with GET access to given endpoint

Parameters:
  • endpoint (Union[str, int, Sequence[Union[str, int]]]) – Name of the endpoint (e.g. dataset/2/tracks)

  • params – Parameters to pass to the endpoint. Defaults to None.

  • mode – Convert result to this format. Defaults to None.

Return type:

Tuple[Union[bytes, Dict[Any, Any], Response, str, None], Optional[LOGSErrorResponse]]

Returns:

The respose of the server and the error code.

getEndpointUrl(endpoint)[source]

Generate full API URL for a given endpoint

Return type:

str

Returns:

The url of the connected LOGS API (for dataset endpoint e.g. https://logs.com/api/2.1/dataset)

getHeader()[source]
Return type:

Dict[str, str]

getUIEndpointUrl(endpoint)[source]

Generate full API URL for a given endpoint

Returns:

The url of the connected LOGS API (for dataset endpoint e.g. https://logs.com/api/2.1/dataset)

Return type:

str

getUIUrl()[source]

Generate full API URL

Returns:

The url of the connected LOGS API (e.g. https://logs.com/api/2.1)

Return type:

str

getUrl(url, parameters=None, responseType=ResponseTypes.JSON, includeUrl=True)[source]

Generate full API URL with GET parameters

Parameters:
  • url (str) – Specify an API url otherwise object internal is used. Defaults to None.

  • parameters (Optional[dict]) – Parameters to pass to an GET request. Defaults to None.

  • responseType (ResponseTypes) – The return value is converted to the specified format. Defaults to “json”.

  • includeUrl (bool)

Returns:

The respose of the server and the error code.

property group: str
property metadata: ServerMetaData
property port: int | None
postEndpoint(endpoint, parameters=None, data={}, responseType=ResponseTypes.JSON)[source]

Connects to the API with PUT access to given endpoint

Parameters:
  • endpoint (Union[str, int, Sequence[Union[str, int]]]) – Name of the endpoint (e.g. dataset/2/tracks)

  • params – Parameters to pass to the endpoint as json body. Defaults to None.

Returns:

The respose of the server and the error code.

postMultipartEndpoint(endpoint, data=[], responseType=ResponseTypes.JSON)[source]
postMultipartUrl(url, data=[], responseType=ResponseTypes.JSON)[source]
postUrl(url, data={}, parameters=None, responseType=ResponseTypes.JSON, includeUrl=True)[source]

Generate full API URL with PUT body

Parameters:
  • url (str) – Specify an API url otherwise object internal is used. Defaults to None.

  • params – Parameters to pass to an PUT request as json body. Defaults to None.

  • mode – The return value is converted to the specified format. Defaults to “json”.

Returns:

The respose of the server and the error code.

printServerStatus()[source]
property protocol: str
putEndpoint(endpoint, data={}, responseType=ResponseTypes.JSON)[source]

Connects to the API with PUT access to given endpoint

Parameters:
  • endpoint (Union[str, int, Sequence[Union[str, int]]]) – Name of the endpoint (e.g. dataset/2/tracks)

  • params – Parameters to pass to the endpoint as json body. Defaults to None.

Return type:

Tuple[Union[bytes, Dict[Any, Any], Response, str, None], Optional[LOGSErrorResponse]]

Returns:

The respose of the server and the error code.

putUrl(url, data={}, responseType=ResponseTypes.JSON)[source]

Generate full API URL with PUT body

Parameters:
  • url (str) – Specify an API url otherwise object internal is used. Defaults to None.

  • params – Parameters to pass to an PUT request as json body. Defaults to None.

  • mode – The return value is converted to the specified format. Defaults to “json”.

Returns:

The respose of the server and the error code.

property server: str
setUrl(url)[source]
property url: str
property version: str
class LOGS.LOGSConnection.MultipartEntry(name, fileName, content)[source]

Bases: object

content: Union[str, dict, FileEntry]
fileName: Optional[str]
name: str
class LOGS.LOGSConnection.ResponseTypes(value)[source]

Bases: Enum

An enumeration.

JSON = 'json'
RAW = 'raw'