Esempio n. 1
0
 def _extract_message_id(response_body: bytes) -> Optional[str]:
     return safe_key_from_xml(
         response_body,
         "SendMessageResponse/SendMessageResult/MessageId"  # Single.
     ) or safe_key_from_xml(
         response_body,
         "SendMessageBatchResponse/SendMessageBatchResult/SendMessageBatchResultEntry/0/MessageId",  # Batch.
     )
Esempio n. 2
0
 def parse_response(self, url: str, status_code: int, headers,
                    body: bytes) -> dict:
     return recursive_json_join(
         {
             "info": {
                 "messageId":
                 safe_key_from_xml(
                     body, "PublishResponse/PublishResult/MessageId")
             }
         },
         super().parse_response(url, status_code, headers, body),
     )
Esempio n. 3
0
def test_key_from_xml(input_params, expected_output):
    assert safe_key_from_xml(*input_params) == expected_output