flowclient.connection¶
Class Connection¶
Connection(*, url: str, token: str, api_version: int = 0, ssl_certificate: Union[str, bool] = True) -> None
A connection to a FlowKit API server.
Attributes¶
-
url
:str
URL of the API server
-
token
:str
JSON Web Token for this API server
-
api_version
:int
, default0
Version of the API to connect to
-
user
:str
Username of token
Parameters¶
-
url
:str
URL of the API server, e.g. "https://localhost:9090"
-
token
:str
JSON Web Token for this API server
-
api_version
:int
, default0
Version of the API to connect to
-
ssl_certificate
:typing.Union
, defaultTrue
Provide a path to an ssl certificate to use, True to use default root certificates, or False to disable ssl verification.
Methods¶
get_url¶
get_url(self, *, route: str, data: Optional[dict] = None, params: Optional[dict] = None) -> httpx.Response
Attempt to get something from the API, and return the raw response object if an error response wasn't received. If an error response was received, raises an error.
Parameters¶
-
route
:str
Path relative to API host to get
-
data
:typing.Optional
, defaultNone
JSON data to send in the request body (optional)
-
params
:typing.Optional
, defaultNone
Data to send as query parameters.
Returns¶
httpx.Response
make_api_query¶
make_api_query(self, parameters: dict) -> 'APIQuery'
post_json¶
post_json(self, *, route: str, data: dict) -> httpx.Response
Attempt to post json to the API, and return the raw response object if an error response wasn't received. If an error response was received, raises an error.
Parameters¶
-
route
:str
Path relative to API host to post_json to
-
data
:dict
Dictionary of json-encodeable data to post_json
Returns¶
httpx.Response
update_token¶
update_token(self, token: str) -> None
Replace this connection's API token with a new one.
Parameters¶
-
token
:str
JSON Web Token for this API server