graphspace_python.api package¶
Submodules¶
graphspace_python.api.client module¶
-
class
graphspace_python.api.client.
GraphSpace
(username, password)[source]¶ Bases:
object
GraphSpace client class.
Connects the user with GraphSpace.
Makes request to the GraphSpace REST APIs and returns the response.
Parameters: Example
Initialising a GraphSpace client can be done in the following way:
>>> from graphspace_python.api.client import GraphSpace >>> graphspace = GraphSpace('user1@example.com', 'user1')
-
auth_token
¶ str – Base64 encoded username and password.
-
username
¶ str – Email of user.
-
api_host
¶ str – Host address of GraphSpace REST API.
-
set_api_host
(host)[source]¶ Manually set host address of GraphSpace REST APIs.
Parameters: host (str) – Host address of GraphSpace APIs. Example
>>> from graphspace_python.api.client import GraphSpace >>> graphspace = GraphSpace('user1@example.com', 'user1') >>> graphspace.set_api_host('localhost:8000')
-
graphspace_python.api.config module¶
graphspace_python.api.errors module¶
-
class
graphspace_python.api.errors.
ErrorHandler
[source]¶ Bases:
object
ErrorHandler class.
Exception handling class for GraphSpace API’s HTTP errors.
-
raise_error
(error, response)[source]¶ Raises exception based on the ‘error_code’ received in response when any HTTP error occurs in API call.
Parameters: Raises: GraphSpaceError
– If an error response is received from the API call, it raises any one of the GraphSpaceError depending upon the error code.
-
-
exception
graphspace_python.api.errors.
GraphSpaceError
(status_code, reason, response)[source]¶ Bases:
exceptions.Exception
GraphSpaceError class.
Base error class for the GraphSpace HTTP errors.
-
status_code
¶ int – HTTP error status code.
-
reason
¶ str – Reason of HTTP error.
-
error_code
¶ int – Error code received from GraphSpace.
-
error_message
¶ str – Error message received from GraphSpace.
-
-
exception
graphspace_python.api.errors.
LayoutNameAlreadyExists
(status_code, reason, response)[source]¶