pyhaystack.client.ops.vendor package¶
Submodules¶
pyhaystack.client.ops.vendor.niagara module¶
Niagara AX/Niagara 4 operation implementations.
-
class
pyhaystack.client.ops.vendor.niagara.
NiagaraAXAuthenticateOperation
(session, retries=0)¶ Bases:
pyhaystack.util.state.HaystackOperation
An implementation of the log-in procedure for Niagara AX. The procedure is as follows:
- Do a request of the log-in URL, without credentials. This sets session cookies in the client. Response should be code 200.
- Pick up the session cookie named ‘niagara_session’, submit this in a GET request for the login URL with a number of other parameters. Response should NOT include the word ‘login’.
Future requests should include the basic authentication credentials.
Attempt to log in to the Niagara AX server.
Parameters: - session – Haystack HTTP session object.
- uri – Possibly partial URI relative to the server base address to perform a query. No arguments shall be given here.
- expect_format – Request that the grid be sent in the given format.
- args – Dictionary of key-value pairs to be given as arguments.
- multi_grid – Boolean indicating if we are to expect multiple grids or not. If True, then the operation will _always_ return a list, otherwise, it will _always_ return a single grid.
- raw_response – Boolean indicating if we should try to parse the result. If True, then we should just pass back the raw HTTPResponse object.
- retries – Number of retries permitted in case of failure.
-
go
()¶ Start the request.
pyhaystack.client.ops.vendor.skyspark module¶
Skyspark operation implementations.
-
class
pyhaystack.client.ops.vendor.skyspark.
SkysparkAuthenticateOperation
(session, retries=2)¶ Bases:
pyhaystack.util.state.HaystackOperation
An implementation of the log-in procedure for Skyspark. The procedure is as follows:
Retrieve the log-in URL (GET request).
Parse the key-values pairs returned, pick up ‘username’, ‘userSalt’ and ‘nonce’.
- Compute
mac = Base64(HMAC_SHA1(key=password, msg=”${username}:${userSalt}”))
- Compute
digest = Base64(SHA1(“${mac}:${nonce}”))
- POST to log-in URL:
nonce: ${nonce} digest: ${digest}
Stash received cookies given in the returned body.
Future requests should the cookies returned.
Attempt to log in to the Skyspark server.
Parameters: - session – Haystack HTTP session object.
- retries – Number of retries permitted in case of failure.
-
go
()¶ Start the request.
-
pyhaystack.client.ops.vendor.skyspark.
binary_encoding
(string, encoding='utf-8')¶ This helper function will allow compatibility with Python 2 and 3
-
pyhaystack.client.ops.vendor.skyspark.
get_digest_info
(param)¶
pyhaystack.client.ops.vendor.widesky module¶
VRT WideSky operation implementations.
-
class
pyhaystack.client.ops.vendor.widesky.
CreateEntityOperation
(session, entities, single)¶ Bases:
pyhaystack.client.ops.entity.EntityRetrieveOperation
Operation for creating entity instances.
Parameters: - session – Haystack HTTP session object.
- entities – A list of entities to create.
-
go
()¶ Start the request, preprocess and submit create request.
-
class
pyhaystack.client.ops.vendor.widesky.
WideskyAuthenticateOperation
(session, retries=0)¶ Bases:
pyhaystack.util.state.HaystackOperation
An implementation of the log-in procedure for WideSky. WideSky uses a M2M variant of OAuth2.0 to authenticate users.
Attempt to log in to the VRT WideSky server. The procedure is as follows:
- POST to auth_dir URI:
- Headers:
- Accept: application/json Authorization: Basic [BASE64:”[ID]:[SECRET]”] Content-Type: application/json
- Body: {
- username: “[USER]”, password: “[PASSWORD]”, grant_type: “password”
}
- EXPECT reply:
- Headers:
- Content-Type: application/json
- Body:
- {
- access_token: ..., refresh_token: ..., expires_in: ..., token_type: ...
}
Parameters: - session – Haystack HTTP session object.
- retries – Number of retries permitted in case of failure.
-
go
()¶ Start the request.