Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions openpaygo/metrics_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ def get_simple_request_dict(self):
simple_request["historical_data"] = self.historical_data
# We prepare the auth
if self.auth_method:
simple_request[
"auth"
] = OpenPAYGOMetricsShared.generate_request_signature_from_data(
simple_request, self.auth_method, self.secret_key
simple_request["auth"] = (
OpenPAYGOMetricsShared.generate_request_signature_from_data(
simple_request, self.auth_method, self.secret_key
)
)
return simple_request

Expand Down Expand Up @@ -83,10 +83,10 @@ def get_condensed_request_dict(self):
raise ValueError(
"Additional variables not present in the data format: " + str(data_copy)
)
condensed_request[
"data"
] = OpenPAYGOMetricsShared.remove_trailing_empty_elements(
condensed_request["data"]
condensed_request["data"] = (
OpenPAYGOMetricsShared.remove_trailing_empty_elements(
condensed_request["data"]
)
)
# We add the historical data
historical_data_copy = copy.deepcopy(self.historical_data)
Expand All @@ -105,10 +105,10 @@ def get_condensed_request_dict(self):
condensed_request["historical_data"].append(time_step_data)
# We prepare the auth
if self.auth_method:
condensed_request[
"auth"
] = OpenPAYGOMetricsShared.generate_request_signature_from_data(
condensed_request, self.auth_method, self.secret_key
condensed_request["auth"] = (
OpenPAYGOMetricsShared.generate_request_signature_from_data(
condensed_request, self.auth_method, self.secret_key
)
)
# We replace the key names by the condensed ones
condensed_request = OpenPAYGOMetricsShared.convert_dict_keys_to_condensed(
Expand Down
16 changes: 8 additions & 8 deletions openpaygo/metrics_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,14 @@ def get_answer_dict(self):
# If there is not data format, we just return the full response
condensed_answer = copy.deepcopy(self.response_dict)
if self.secret_key:
condensed_answer[
"auth"
] = OpenPAYGOMetricsShared.generate_response_signature_from_data(
serial_number=self.request_dict.get("serial_number"),
request_count=self.request_dict.get("request_count"),
data=condensed_answer,
timestamp=self.request_dict.get("timestamp"),
secret_key=self.secret_key,
condensed_answer["auth"] = (
OpenPAYGOMetricsShared.generate_response_signature_from_data(
serial_number=self.request_dict.get("serial_number"),
request_count=self.request_dict.get("request_count"),
data=condensed_answer,
timestamp=self.request_dict.get("timestamp"),
secret_key=self.secret_key,
)
)
return OpenPAYGOMetricsShared.convert_dict_keys_to_condensed(condensed_answer)

Expand Down