def _update_context(headers, context): """ Updates the given call context based on the contents of the given response. """ idempotence_request_timestamp_value = get_header_value( headers, "X-GCS-Idempotence-Request-Timestamp") if idempotence_request_timestamp_value is not None: idempotence_request_timestamp = long( idempotence_request_timestamp_value) context.idempotence_request_timestamp = idempotence_request_timestamp else: context.idempotence_request_timestamp = None
def __is_json(headers): content_type = get_header_value(headers, "Content-Type") return content_type is None or "application/json".lower( ) == content_type or content_type.lower().startswith( "application/json")
def get_header_value(self, header_name): """ :return: The value header with the given name, or None if there was no such header. """ return get_header_value(self.__headers, header_name)