Exemple #1
0
	def ListOrders(self, **kwargs):
		"""
		Requests the list of Orders that match the specified criteria.

		Returns the response XML (``str``).

		For a complete list of arguments and values:
		http://docs.developer.amazonservices.com/en_US/orders/2013-09-01/Orders_ListOrders.html
		"""
		# Grab default args.
		args = self.new_args()

		# Merge args passed to function w/ default args.
		args.update(kwargs)

		# Ensure our dates are properly formatted.
		if 'CreatedAfter' in kwargs and kwargs['CreatedAfter']:
			args['CreatedAfter'] = datetime_to_iso8601(kwargs['CreatedAfter'], name='CreatedAfter')

		if 'CreatedBefore' in kwargs and kwargs['CreatedBefore']:
			args['CreatedBefore'] = datetime_to_iso8601(kwargs['CreatedBefore'], name='CreatedBefore')

		if 'LastUpdatedAfter' in kwargs and kwargs['LastUpdatedAfter']:
			args['LastUpdatedAfter'] = datetime_to_iso8601(kwargs['LastUpdatedAfter'], name='LastUpdatedAfter')

		if 'LastUpdatedBefore' in kwargs and kwargs['LastUpdatedBefore']:
			args['LastUpdatedBefore'] = datetime_to_iso8601(kwargs['LastUpdatedBefore'], name='LastUpdatedBefore')

		return self.send_request('ListOrders', args)
    def ListOrders(self, **kwargs):
        """
		Requests the list of Orders that match the specified criteria.

		Returns the response XML (``str``).

		For a complete list of arguments and values:
		http://docs.developer.amazonservices.com/en_US/orders/2013-09-01/Orders_ListOrders.html
		"""
        # Grab default args.
        args = self.new_args()

        # Merge args passed to function w/ default args.
        args.update(kwargs)

        # Ensure our dates are properly formatted.
        if 'CreatedAfter' in kwargs and kwargs['CreatedAfter']:
            args['CreatedAfter'] = datetime_to_iso8601(kwargs['CreatedAfter'],
                                                       name='CreatedAfter')

        if 'CreatedBefore' in kwargs and kwargs['CreatedBefore']:
            args['CreatedBefore'] = datetime_to_iso8601(
                kwargs['CreatedBefore'], name='CreatedBefore')

        if 'LastUpdatedAfter' in kwargs and kwargs['LastUpdatedAfter']:
            args['LastUpdatedAfter'] = datetime_to_iso8601(
                kwargs['LastUpdatedAfter'], name='LastUpdatedAfter')

        if 'LastUpdatedBefore' in kwargs and kwargs['LastUpdatedBefore']:
            args['LastUpdatedBefore'] = datetime_to_iso8601(
                kwargs['LastUpdatedBefore'], name='LastUpdatedBefore')

        return self.send_request('ListOrders', args)
Exemple #3
0
    def get_report_request_count(self,
                                 report_types=None,
                                 statuses=None,
                                 from_date=None,
                                 to_date=None,
                                 marketplaces=None,
                                 debug=None):
        """
		Gets the total number of Report Requests that match the query.
		
		*report_types* (**sequence**) is used to filter on Report Type
		(``str``). This can contain any keys or values from
		``REPORT_TYPES``. Default is ``None`` to not filter on Report Type.
		
		*statuses* (**sequence**) is used to filter on Report Processing
		Status (``str``). This can contain any keys or values from
		``REPORT_STATUSES``. Default is ``None`` to not filter on Report
		Processing Status.
		
		*from_date* (``datetime`` or ``float``) is the start of the date
		range to use for selecting Report Requests. Default is ``None`` for
		90 days ago.
		
		*to_date* (``datetime`` or ``float``) is the end of the date range
		to use for selecting Report Requests. Default is ``None`` for now.
		
		*marketplaces* (**sequence**) is the list of Amazon Marketplace IDs
		(``str``). Default is ``None`` for all marketplaces.
		
		Returns the raw XML response (``str``).
		"""
        if from_date is not None:
            from_date = datetime_to_iso8601(from_date, name='from_date')

        if to_date is not None:
            to_date = datetime_to_iso8601(to_date, name='to_date')

        # Build args.
        args = self.new_args()
        args['Action'] = 'GetReportRequestCount'

        if report_types is not None:
            args.update(report_type_args(report_types, name='report_types'))

        if statuses is not None:
            args.update(status_args(statuses, name='statuses'))

        if from_date:
            args['RequestedFromDate'] = from_date

        if to_date:
            args['RequestedToDate'] = to_date

        if marketplaces is not None:
            args.update(marketplace_args(marketplaces, name='marketplaces'))

        # Send request.
        return self.send_request(args, debug=debug)
	def request_report(self, report_type, start_date=None, end_date=None, show_sales_channel=None, marketplaces=None, debug=None):
		"""
		Requests that the specified Report be created.
		
		*report_type* (``str``) is the report type.
		
		*start_date* (``datetime`` or ``float``) is the start of the date
		range used for selecting the data to report. Default is ``None`` for
		now.
		
		*end_date* (``datetime`` or ``float``) is the end of the date range
		used for selecting the data to report. Default is ``None`` for now.
		
		*show_sales_channel* (``bool``) indicates that an additional column
		for several Order Reports should be shown (``True``), or not
		(``False``). Default is ``None`` to not show the additional column.
		
		*marketplaces* (**sequence**) is the list of Amazon Marketplace IDs
		(``str``). Default is ``None`` for all marketplaces.
		
		Returns the Report Request ID (``str``) if the response is to be
		parsed; otherwise, the raw XML response (``str``)
		"""
		report_type = REPORT_TYPES.get(report_type, report_type)
		if not isinstance(report_type, basestring):
			raise TypeError("report_type:{!r} is not a string.".format(report_type))
		elif not report_type:
			raise ValueError("report_type:{!r} cannot be empty.".format(report_type))
		report_type = report_type.encode('ASCII')
		
		if start_date is not None:
			start_date = datetime_to_iso8601(start_date, name='start_date')
			
		if end_date is not None:
			end_date = datetime_to_iso8601(end_date, name='end_date')
			
		if show_sales_channel is not None:
			show_sales_channel = bool(show_sales_channel)
		
		# Build request.
		args = self.new_args()
		args['Action'] = 'RequestReport'
		args['ReportType'] = report_type
		
		if start_date:
			args['StartDate'] = start_date
			
		if end_date:
			args['EndDate'] = end_date
			
		if show_sales_channel is not None:
			args['ReportOptions=ShowSalesChannel'] = 'true' if show_sales_channel else 'false'
	
		if marketplaces is not None:
			args.update(marketplace_args(marketplaces, name='marketplaces'))
			
		# Send request.
		return self.send_request(args, debug=debug)
	def get_report_count(self, report_types=None, acknowledged=None, from_date=None, to_date=None, marketplaces=None, debug=None):
		"""
		Gets the total number of Reports that match the query.
		
		*report_types* (**sequence**) is used to filter on Report Type
		(``str``). This can contain any keys or values from
		``REPORT_TYPES``. Default is ``None`` to not filter on Report Type.
		
		*acknowledged* (``bool``) is used to filter on whether Order Reports
		have been acknowledged (``True``), or not (``False``). Default is
		``None`` to not filter on Acknowledged state. 
		
		.. NOTE:: Setting *acknowledged* to ``True`` will result in only
		   Order Reports (not Listing Reports) being returned.
		
		*from_date* (``datetime`` or ``float``) is the start of the date
		range to use for selecting Report Requests. Default is ``None`` for
		90 days ago.
		
		*to_date* (``datetime`` or ``float``) is the end of the date range
		to use for selecting Report Requests. Default is ``None`` for now.
		
		*marketplaces* (**sequence**) is the list of Amazon Marketplace IDs
		(``str``). Default is ``None`` for all marketplaces.
		
		Returns the raw XML response (``str``).
		"""
		if acknowledged is not None:
			acknowledged = bool(acknowledged)
			
		if from_date is not None:
			from_date = datetime_to_iso8601(from_date, name='from_date')
			
		if to_date is not None:
			to_date = datetime_to_iso8601(to_date, name='to_date')
			
		# Build args.
		args = self.new_args()
		args['Action'] = 'GetReportCount'
		
		if report_types is not None:
			args.update(report_type_args(report_types, name='report_types'))
				
		if acknowledged is not None:
			args['Acknowledged'] = 'true' if acknowledged else 'false'
			
		if from_date:
			args['RequestedFromDate'] = from_date
			
		if to_date:
			args['RequestedToDate'] = to_date
			
		if marketplaces is not None:
			args.update(marketplace_args(marketplaces, name='marketplaces'))
			
		# Send request.
		return self.send_request(args, debug=debug)
	def get_report_request_count(self, report_types=None, statuses=None, from_date=None, to_date=None, marketplaces=None, debug=None):
		"""
		Gets the total number of Report Requests that match the query.
		
		*report_types* (**sequence**) is used to filter on Report Type
		(``str``). This can contain any keys or values from
		``REPORT_TYPES``. Default is ``None`` to not filter on Report Type.
		
		*statuses* (**sequence**) is used to filter on Report Processing
		Status (``str``). This can contain any keys or values from
		``REPORT_STATUSES``. Default is ``None`` to not filter on Report
		Processing Status.
		
		*from_date* (``datetime`` or ``float``) is the start of the date
		range to use for selecting Report Requests. Default is ``None`` for
		90 days ago.
		
		*to_date* (``datetime`` or ``float``) is the end of the date range
		to use for selecting Report Requests. Default is ``None`` for now.
		
		*marketplaces* (**sequence**) is the list of Amazon Marketplace IDs
		(``str``). Default is ``None`` for all marketplaces.
		
		Returns the raw XML response (``str``).
		"""
		if from_date is not None:
			from_date = datetime_to_iso8601(from_date, name='from_date')
			
		if to_date is not None:
			to_date = datetime_to_iso8601(to_date, name='to_date')
			
		# Build args.
		args = self.new_args()
		args['Action'] = 'GetReportRequestCount'
		
		if report_types is not None:
			args.update(report_type_args(report_types, name='report_types'))
			
		if statuses is not None:
			args.update(status_args(statuses, name='statuses'))
				
		if from_date:
			args['RequestedFromDate'] = from_date
			
		if to_date:
			args['RequestedToDate'] = to_date
			
		if marketplaces is not None:
			args.update(marketplace_args(marketplaces, name='marketplaces'))
			
		# Send request.
		return self.send_request(args, debug=debug)
Exemple #7
0
    def GetFeedSubmissionCount(self,
                               feed_types=None,
                               statuses=None,
                               from_date=None,
                               to_date=None,
                               debug=None):
        """
		Requests a count of all Feed Submissions that match the specified
		criteria.

		*feed_types* (**sequence**) contains each Feed Type (``str``) to
		filter the list of submissions to count. This can contain any keys
		or values from ``FEED_TYPES``. Default is ``None`` for all Feed
		Types.

		*statuses* (**sequence**) contains each Processing Status
		(``str``) to filter the list of submissions to count. This can
		contain keys or values from ``PROCESSING_STATUSES``. Default is

		*from_date* (``datetime.datetime`` or ``float``) is the earliest
		date to filter the list of submissions to count. Default is
		``None`` for 90 days ago.

		*to_date* (``datetime.datetime`` or ``float``) is the latest date to
		filter the list of submissions to cancel. count is ``None`` for
		now.

		Returns the response XML (``str``).
		"""
        # Build args.
        args = self.new_args()
        args['Action'] = 'GetFeedSubmissionCount'

        if feed_types is not None:
            args.update(feed_type_args(feed_types, name='feed_types'))

        if statuses is not None:
            args.update(status_args(statuses, name='statuses'))

        if from_date is not None:
            args['SubmittedFromDate'] = datetime_to_iso8601(from_date,
                                                            name='from_date')

        if to_date is not None:
            args['SubmittedToDate'] = datetime_to_iso8601(to_date,
                                                          name='to_date')

        # Send request.
        return self.send_request(args, debug=debug)
    def new_args(self):
        """
		Returns a new ``dict`` of default arguments.
		"""
        return {
            'AWSAccessKeyId': self.access_key,
            'SellerId': self.merchant_id,
            'Timestamp': datetime_to_iso8601(datetime.datetime.utcnow()),
            'Version': self.sellers_api_version
        }
	def new_args(self):
		"""
		Returns a new ``dict`` of default arguments.
		"""
		return {
			'AWSAccessKeyId': self.access_key,
			'SellerId': self.merchant_id,
			'Timestamp': datetime_to_iso8601(datetime.datetime.utcnow()),
			'Version': self.products_api_version
		}
Exemple #10
0
	def count_submissions(self, feed_types=None, statuses=None, from_date=None, to_date=None, debug=None):
		"""
		Requests a count of all Feed Submissions that match the specified
		criteria.

		*feed_types* (**sequence**) contains each Feed Type (``str``) to
		filter the list of submissions to count. This can contain any keys
		or values from ``FEED_TYPES``. Default is ``None`` for all Feed
		Types.

		*statuses* (**sequence**) contains each Processing Status
		(``str``) to filter the list of submissions to count. This can
		contain keys or values from ``PROCESSING_STATUSES``. Default is

		*from_date* (``datetime.datetime`` or ``float``) is the earliest
		date to filter the list of submissions to count. Default is
		``None`` for 90 days ago.

		*to_date* (``datetime.datetime`` or ``float``) is the latest date to
		filter the list of submissions to cancel. count is ``None`` for
		now.

		Returns the response XML (``str``).
		"""
		# Build args.
		args = self.new_args()
		args['Action'] = 'GetFeedSubmissionCount'

		if feed_types is not None:
			args.update(feed_type_args(feed_types, name='feed_types'))

		if statuses is not None:
			args.update(status_args(statuses, name='statuses'))

		if from_date is not None:
			args['SubmittedFromDate'] = datetime_to_iso8601(from_date, name='from_date')

		if to_date is not None:
			args['SubmittedToDate'] = datetime_to_iso8601(to_date, name='to_date')

		# Send request.
		return self.send_request(args, debug=debug)
Exemple #11
0
	def new_args(self):
		'''
		Returns base query args for the Orders API--these
		items are used by each class
		'''
		return {
			'AWSAccessKeyId': self.access_key,
			'SellerId': self.merchant_id,
			'Timestamp': datetime_to_iso8601(datetime.datetime.utcnow()),
			'Version': self.mws_api_version
		}
Exemple #12
0
	def new_args(self):
		"""
		Returns a new ``dict`` of default arguments.
		"""
		args = {
			'AWSAccessKeyId': self.access_key,
			'Merchant': self.merchant_id,
			'Timestamp': datetime_to_iso8601(datetime.datetime.utcnow()),
			'Version': self.feeds_api_version
		}
		return args
	def new_args(self):
		"""
		Returns a new set of default arguments (``dict``).
		
		*marketplaces* (**sequence**) is the list of marketplace IDs
		(``str``). Default is ``None``.
		"""
		return {
			'AWSAccessKeyId': self.access_key,
			'SellerId': self.merchant_id,
			'Timestamp': datetime_to_iso8601(datetime.datetime.utcnow()),
			'Version': self.reports_api_version
		}
Exemple #14
0
    def new_args(self):
        """
		Returns a new set of default arguments (``dict``).
		
		*marketplaces* (**sequence**) is the list of marketplace IDs
		(``str``). Default is ``None``.
		"""
        return {
            'AWSAccessKeyId': self.access_key,
            'SellerId': self.merchant_id,
            'Timestamp': datetime_to_iso8601(datetime.datetime.utcnow()),
            'Version': self.reports_api_version
        }
Exemple #15
0
    def get_report_count(self,
                         report_types=None,
                         acknowledged=None,
                         from_date=None,
                         to_date=None,
                         marketplaces=None,
                         debug=None):
        """
		Gets the total number of Reports that match the query.
		
		*report_types* (**sequence**) is used to filter on Report Type
		(``str``). This can contain any keys or values from
		``REPORT_TYPES``. Default is ``None`` to not filter on Report Type.
		
		*acknowledged* (``bool``) is used to filter on whether Order Reports
		have been acknowledged (``True``), or not (``False``). Default is
		``None`` to not filter on Acknowledged state. 
		
		.. NOTE:: Setting *acknowledged* to ``True`` will result in only
		   Order Reports (not Listing Reports) being returned.
		
		*from_date* (``datetime`` or ``float``) is the start of the date
		range to use for selecting Report Requests. Default is ``None`` for
		90 days ago.
		
		*to_date* (``datetime`` or ``float``) is the end of the date range
		to use for selecting Report Requests. Default is ``None`` for now.
		
		*marketplaces* (**sequence**) is the list of Amazon Marketplace IDs
		(``str``). Default is ``None`` for all marketplaces.
		
		Returns the raw XML response (``str``).
		"""
        if acknowledged is not None:
            acknowledged = bool(acknowledged)

        if from_date is not None:
            from_date = datetime_to_iso8601(from_date, name='from_date')

        if to_date is not None:
            to_date = datetime_to_iso8601(to_date, name='to_date')

        # Build args.
        args = self.new_args()
        args['Action'] = 'GetReportCount'

        if report_types is not None:
            args.update(report_type_args(report_types, name='report_types'))

        if acknowledged is not None:
            args['Acknowledged'] = 'true' if acknowledged else 'false'

        if from_date:
            args['RequestedFromDate'] = from_date

        if to_date:
            args['RequestedToDate'] = to_date

        if marketplaces is not None:
            args.update(marketplace_args(marketplaces, name='marketplaces'))

        # Send request.
        return self.send_request(args, debug=debug)
Exemple #16
0
	def cancel_submissions(self, submissions=None, feed_types=None, from_date=None, to_date=None, all_submissions=None, debug=None):
		"""
		Requests all Feed Submissions that match the specified criteria to
		be cancelled.

		.. NOTE:: Only feeds that have been submitted but have not yet been
		   processed can be cancelled (i.e., where status is "_SUBMITTED_").

		To delete specific Feed Submissions, set *submissions*:

		*submissions* (**sequence**) contains the ID (``str``) of each Feed
		Submission to cancel.

		To delete Feed Submissions based upon a query, use any of the
		following: *feed_types*, *from_date*, *to_date*.

		*feed_types* (**sequence**) contains each Feed Type (``str``) to
		filter the list of submissions to cancel. This can contain any of
		the keys and values from ``FEED_TYPES``. Default is ``None`` for all
		Feed Types.

		*from_date* (``datetime.datetime`` or ``float``) is the earliest
		date to filter the list of submissions to cancel. Default is
		``None`` for 180 days ago.

		*to_date* (``datetime.datetime`` or ``float``) is the latest date to
		filter the list of submissions to cancel. Default is ``None`` for
		now.

		To delete all Feed Submissions, set *all_submissions* to ``True``:

		*all_submissions* (``bool``) indicates whether all Feed Submissions
		should be deleted (``True``), or not (``False``). This is used to
		prevent accidental deletion of all Feed Submissions.

		Returns the response XML (``str``).
		"""
		cancel_list = 1 if submissions is not None else 0
		cancel_query = 1 if (feed_types is not None or from_date is not None or to_date is not None) else 0
		cancel_all = 1 if all_submissions else 0
		cancel_sum = cancel_list + cancel_query + cancel_all
		if cancel_sum != 1:
			if cancel_sum:
				msg = []
				if cancel_list:
					msg.append("submissions:{subs!r}")
				if cancel_query:
					msg.append("a query (feed_types:{types!r}, from_date:{from_date!r}, and to_date:{to_date!r})")
				if cancel_all:
					msg.append("all_submissions:{all_subs!r}")
				msg = "Only one of {} can be set.".format(", or ".join(msg))
			else:
				msg = "Either submissions:{subs!r}, or a query (feed_types:{types!r}, from_date:{from_date!r}, and to_date:{to_date!r}), or all_submissions:{all_subs!r} must be set."

			raise ValueError(msg.format(subs=submissions, types=feed_types, to_date=to_date, from_date=from_date, all_subs=all_submissions))

		# Build args.
		args = self.new_args()
		args['Action'] = 'CancelFeedSubmissions'

		if submissions is not None:
			args.update(submission_args(submissions, name='submissions'))

		if feed_types is not None:
			args.update(feed_type_args(feed_types, name='feed_types'))

		if from_date is not None:
			args['SubmittedFromDate'] = datetime_to_iso8601(from_date, name='from_date')

		if to_date is not None:
			args['SubmittedToDate'] = datetime_to_iso8601(to_date, name='to_date')

		# Send request.
		return self.send_request(args, debug=debug)
Exemple #17
0
	def list_orders(self, created_after=None, updated_after=None, order_statuses=None, marketplaces=None):
		"""
		Requests the list of Orders that match the specified criteria.

		Either *created_after* or *updated_after* must be set, but not both.

		*created_after* (``datetime.datetime`` or ``float``) is used to
		select orders that were created at/after the specified date-time.

		*updated_after* (``datetime.datetime`` or ``float``) is used to
		select orders that were updated at/after the specified date-time.

		The query can be further refined by specifying any of the following:

		*order_statuses* (**sequence**) contains each Order Status (``str``)
		to filter the list of orders to list. Default is ``None`` for all
		Order Statuses.

		.. SEEALSO:: ``ORDER_STATUSES``.

		*marketplaces* (**sequence**) contains the ID (``str``) of each
		Amazon Marketplace to list orders from. Default is ``None`` for all
		Amazon Marketplaces.

		Returns the response XML (``str``).
		"""
		if (created_after is None and updated_after is None) or (created_after is not None and updated_after is not None):
			raise ValueError("Either created_after:{!r} or updated_after:{!r} must be set, but not both.".format(created_after, updated_after))

		args = self.new_args()

		if created_after is not None:
			args['CreatedAfter'] = datetime_to_iso8601(created_after, name='created_after')

		if updated_after is not None:
			args['LastUpdatedAfter'] = datetime_to_iso8601(updated_after, name='updated_after')

		if order_statuses is not None:
			if not is_sequence(order_statuses):
				raise TypeError("order_statuses:{!r} is not a sequence.".format(order_statuses))
			elif not order_statuses:
				raise ValueError("order_statuses:{!r} cannot be empty.".format(order_statuses))
			amazon_statuses = []
			for i, status in enumerate(order_statuses):
				status = ORDER_STATUSES.get(status, status)
				if not isinstance(status, basestring):
					raise TypeError("order_statuses[{}]:{!r} is not a string.".format(i, status))
				elif not status:
					raise ValueError("order_statuses[{}]:{!r} cannot be empty.".format(i, status))
				try:
					status = status.encode('ASCII')
				except UnicodeDecodeError as e:
					e.reason += " for order_statuses[{}]".format(i)
					e.args = e.args[:4] + (e.reason,)
					raise e
				amazon_statuses.append(status)
			args['OrderStatus'] = amazon_statuses

		if marketplaces is not None:
			if not is_sequence(marketplaces):
				raise TypeError("marketplaces:{!r} is not a sequence.".format(marketplaces))
			elif not marketplaces:
				raise ValueError("marketplaces:{!r} cannot be empty.".format(marketplaces))
			for i, market in enumerate(marketplaces):
				if not isinstance(market, basestring):
					raise TypeError("marketplaces[{}]:{!r} is not a string.".format(i, market))
				elif not market:
					raise ValueError("marketplaces[{}]:{!r} cannot be empty.".format(i, market))
				try:
					market = market.encode('ASCII')
				except UnicodeDecodeError as e:
					e.reason += " for marketplaces[{}]".format(i)
					e.args = e.args[:4] + (e.reason,)
					raise e
			args['MarketplaceId'] = marketplaces

		return self.send_request('ListOrders', args)
Exemple #18
0
    def cancel_report_requests(self,
                               requests=None,
                               report_types=None,
                               statuses=None,
                               from_date=None,
                               to_date=None,
                               marketplaces=None,
                               debug=None):
        """
		Cancels all Report Requests that match the query.
		
		.. NOTE:: Report Requests that have already begun processing cannot
		   be cancelled.
		
		To cancel Report Requests based upon ID use *requests*.
		
		*requests* (**sequence**) is used to filter on Report Request ID
		(``str``). If not ``None``, no other query arguments will be used
		and only those Report Requests with matching IDs will be returned.
		Default is ``None`` to not use Report Request IDs.
		
		To cancel Report Requests based upon a query use any combination of
		the following: *report_types*, *statuses*, *from_date*, *to_date*,
		and *marketplaces*.
		
		*report_types* (**sequence**) is used to filter on Report Type
		(``str``). This can contain any keys or values from
		``REPORT_TYPES``. Default is ``None`` to not filter on Report Type.
		
		*statuses* (**sequence**) is used to filter on Report Processing
		Status (``str``). This can contain any keys or values from
		``REPORT_STATUSES``. Default is ``None`` to not filter on Report
		Processing Status.
		
		*from_date* (``datetime`` or ``float``) is the start of the date
		range to use for selecting Report Requests. Default is ``None`` for
		90 days ago.
		
		*to_date* (``datetime`` or ``float``) is the end of the date range
		to use for selecting Report Requests. Default is ``None`` for now.
		
		*marketplaces* (**sequence**) is the list of Amazon Marketplace IDs
		(``str``). Default is ``None`` for all marketplaces.
		
		Returns the raw XML response (``str``).
		"""
        if from_date is not None:
            from_date = datetime_to_iso8601(from_date, name='from_date')

        if to_date is not None:
            to_date = datetime_to_iso8601(to_date, name='to_date')

        # Build args.
        args = self.new_args()
        args['Action'] = 'CancelReportRequests'

        if requests:
            args.update(request_args(requests, name='requests'))

        else:
            if report_types is not None:
                args.update(report_type_args(report_types,
                                             name='report_types'))

            if statuses is not None:
                args.update(status_args(statuses, name='statuses'))

            if from_date:
                args['RequestedFromDate'] = from_date

            if to_date:
                args['RequestedToDate'] = to_date

            if marketplaces is not None:
                args.update(marketplace_args(marketplaces,
                                             name='marketplaces'))

        # Send request.
        return self.send_request(args, debug=debug)
Exemple #19
0
    def request_report(self,
                       report_type,
                       start_date=None,
                       end_date=None,
                       show_sales_channel=None,
                       marketplaces=None,
                       debug=None):
        """
		Requests that the specified Report be created.
		
		*report_type* (``str``) is the report type.
		
		*start_date* (``datetime`` or ``float``) is the start of the date
		range used for selecting the data to report. Default is ``None`` for
		now.
		
		*end_date* (``datetime`` or ``float``) is the end of the date range
		used for selecting the data to report. Default is ``None`` for now.
		
		*show_sales_channel* (``bool``) indicates that an additional column
		for several Order Reports should be shown (``True``), or not
		(``False``). Default is ``None`` to not show the additional column.
		
		*marketplaces* (**sequence**) is the list of Amazon Marketplace IDs
		(``str``). Default is ``None`` for all marketplaces.
		
		Returns the Report Request ID (``str``) if the response is to be
		parsed; otherwise, the raw XML response (``str``)
		"""
        report_type = REPORT_TYPES.get(report_type, report_type)
        if not isinstance(report_type, basestring):
            raise TypeError(
                "report_type:{!r} is not a string.".format(report_type))
        elif not report_type:
            raise ValueError(
                "report_type:{!r} cannot be empty.".format(report_type))
        report_type = report_type.encode('ASCII')

        if start_date is not None:
            start_date = datetime_to_iso8601(start_date, name='start_date')

        if end_date is not None:
            end_date = datetime_to_iso8601(end_date, name='end_date')

        if show_sales_channel is not None:
            show_sales_channel = bool(show_sales_channel)

        # Build request.
        args = self.new_args()
        args['Action'] = 'RequestReport'
        args['ReportType'] = report_type

        if start_date:
            args['StartDate'] = start_date

        if end_date:
            args['EndDate'] = end_date

        if show_sales_channel is not None:
            args[
                'ReportOptions=ShowSalesChannel'] = 'true' if show_sales_channel else 'false'

        if marketplaces is not None:
            args.update(marketplace_args(marketplaces, name='marketplaces'))

        # Send request.
        return self.send_request(args, debug=debug)
Exemple #20
0
    def get_report_request_list(self,
                                requests=None,
                                max_count=None,
                                report_types=None,
                                statuses=None,
                                from_date=None,
                                to_date=None,
                                marketplaces=None,
                                debug=None):
        """
		Requests for the list of Report Requests that match the query.
		
		To list Report Requests based upon ID use *requests*.
		
		*requests* (**sequence**) is used to filter on Report Request ID
		(``str``). If not ``None``, no other query arguments will be used
		and only those Report Requests with matching IDs will be returned.
		Default is ``None`` to not use Report Request IDs.
		
		To list Report Requests based upon a query use any combination of
		the following: *max_count*, *report_types*, *statuses*, *from_date*,
		*to_date*, and *marketplaces*.
		
		*max_count* (``int``) is the maximum number of Report Requests to
		return per response. This must between 1 and 100 inclusive. Default
		is 10.
		
		*report_types* (**sequence**) is used to filter on Report Type
		(``str``). This can contain any keys or values from
		``REPORT_TYPES``. Default is ``None`` to not filter on Report Type.
		
		*statuses* (**sequence**) is used to filter on Report Processing
		Status (``str``). This can contain any keys or values from
		``REPORT_STATUSES``. Default is ``None`` to not filter on Report
		Processing Status.
		
		*from_date* (``datetime`` or ``float``) is the start of the date
		range to use for selecting Report Requests. Default is ``None`` for
		90 days ago.
		
		*to_date* (``datetime`` or ``float``) is the end of the date range
		to use for selecting Report Requests. Default is ``None`` for now.
		
		*marketplaces* (**sequence**) is the list of Amazon Marketplace IDs
		(``str``). Default is ``None`` for all marketplaces.
		
		Returns the raw XML response (``str``).
		"""
        if max_count is not None:
            if not isinstance(max_count, (int, long)):
                raise TypeError(
                    "max_count:{!r} is not an int.".format(max_count))
            elif max_count < 1 or 100 < max_count:
                raise ValueError(
                    "max_count:{!r} is not between 1 and 100 inclusive.".
                    format(max_count))

        if from_date is not None:
            from_date = datetime_to_iso8601(from_date, name='from_date')

        if to_date is not None:
            to_date = datetime_to_iso8601(to_date, name='to_date')

        # Build args.
        args = self.new_args()
        args['Action'] = 'GetReportRequestList'

        if requests:
            args.update(request_args(requests, name='requests'))

        else:
            if max_count:
                args['MaxCount'] = max_count

            if report_types is not None:
                args.update(report_type_args(report_types,
                                             name='report_types'))

            if statuses is not None:
                args.update(status_args(statuses, name='statuses'))

            if from_date:
                args['RequestedFromDate'] = from_date

            if to_date:
                args['RequestedToDate'] = to_date

            if marketplaces is not None:
                args.update(marketplace_args(marketplaces,
                                             name='marketplaces'))

        # Send request.
        return self.send_request(args, debug=debug)
	def cancel_report_requests(self, requests=None, report_types=None, statuses=None, from_date=None, to_date=None, marketplaces=None, debug=None):
		"""
		Cancels all Report Requests that match the query.
		
		.. NOTE:: Report Requests that have already begun processing cannot
		   be cancelled.
		
		To cancel Report Requests based upon ID use *requests*.
		
		*requests* (**sequence**) is used to filter on Report Request ID
		(``str``). If not ``None``, no other query arguments will be used
		and only those Report Requests with matching IDs will be returned.
		Default is ``None`` to not use Report Request IDs.
		
		To cancel Report Requests based upon a query use any combination of
		the following: *report_types*, *statuses*, *from_date*, *to_date*,
		and *marketplaces*.
		
		*report_types* (**sequence**) is used to filter on Report Type
		(``str``). This can contain any keys or values from
		``REPORT_TYPES``. Default is ``None`` to not filter on Report Type.
		
		*statuses* (**sequence**) is used to filter on Report Processing
		Status (``str``). This can contain any keys or values from
		``REPORT_STATUSES``. Default is ``None`` to not filter on Report
		Processing Status.
		
		*from_date* (``datetime`` or ``float``) is the start of the date
		range to use for selecting Report Requests. Default is ``None`` for
		90 days ago.
		
		*to_date* (``datetime`` or ``float``) is the end of the date range
		to use for selecting Report Requests. Default is ``None`` for now.
		
		*marketplaces* (**sequence**) is the list of Amazon Marketplace IDs
		(``str``). Default is ``None`` for all marketplaces.
		
		Returns the raw XML response (``str``).
		"""
		if from_date is not None:
			from_date = datetime_to_iso8601(from_date, name='from_date')
		
		if to_date is not None:
			to_date = datetime_to_iso8601(to_date, name='to_date')
		
		# Build args.
		args = self.new_args()
		args['Action'] = 'CancelReportRequests'
		
		if requests:
			args.update(request_args(requests, name='requests'))
				
		else:
			if report_types is not None:
				args.update(report_type_args(report_types, name='report_types'))
					
			if statuses is not None:
				args.update(status_args(statuses, name='statuses'))
					
			if from_date:
				args['RequestedFromDate'] = from_date
				
			if to_date:
				args['RequestedToDate'] = to_date
				
			if marketplaces is not None:
				args.update(marketplace_args(marketplaces, name='marketplaces'))
				
		# Send request.
		return self.send_request(args, debug=debug)
Exemple #22
0
	def list_submissions(self, submissions=None, count=None, feed_types=None, statuses=None, from_date=None, to_date=None, debug=None):
		"""
		Requests for the list of Feed Submissions that match the specified
		criteria.

		To list only specific Feed Submissions, set *submissions*.

		*submissions* (**sequence**) contains the ID (``str``) of each Feed
		Submission to list.

		To list Feed Submissions based upon a query, use the following:

		*count* (``int``) is the maximum number of Feed Submissions to
		list. This cannot exceed 100. Default is ``None`` for 10.

		*feed_types* (**sequence**) contains each Feed Type (``str``) to
		filter the list of submissions to list. This can contain any of the
		keys or values in ``FEED_TYPES``. Default is ``None`` for all Feed
		Types.

		*statuses* (**sequence**) contains each Processing Status
		(``str``) to filter the list of submissions to count. This can
		contain any of the keys or values from ``PROCESSING_STATUSES``.
		Default is ``None`` for all Processing Statuses.

		*from_date* (``datetime.datetime`` or ``float``) is the earliest
		date to filter the list of submissions to count. Default is
		``None`` for 180 days ago.

		*to_date* (``datetime.datetime`` or ``float``) is the latest date to
		filter the list of submissions to cancel. count is ``None`` for
		now.

		Returns the response XML (``str``).
		"""
		if submissions is not None and (count is not None or feed_types is not None or statuses is not None or from_date is not None or to_date is not None):
			raise ValueError("Only submissions:{subs!r}, or a query (count:{count!r}, feed_types:{feed_types!r}, statuses:{statuses!r}, from_date:{from_date!r}, and to_date:{to_date!r}) can be set.".format(
				subs=submissions,
				count=count,
				feed_types=feed_types,
				statuses=statuses,
				from_date=from_date,
				to_date=to_date
			))

		# Build args.
		args = self.new_args()
		args['Action'] = 'GetFeedSubmissionList'

		if submissions is not None:
			args.update(submission_args(submissions, name='submissions'))

		if count is not None:
			if not isinstance(count, (int, long)):
				raise TypeError("count:{!r} is not an integer.".format(count))
			elif count < 1 or 100 < count :
				raise ValueError("count:{!r} is not between 1 and 100 inclusive.".format(count))
			args['MaxCount'] = str(count)

		if feed_types is not None:
			args.update(feed_type_args(feed_types, name='feed_types'))

		if statuses is not None:
			args.update(status_args(statuses, name='statuses'))

		if from_date is not None:
			args['SubmittedFromDate'] = datetime_to_iso8601(from_date, name='from_date')

		if to_date is not None:
			args['SubmittedToDate'] = datetime_to_iso8601(to_date, name='to_date')

		# Send request.
		return self.send_request(args, debug=debug)
Exemple #23
0
    def CancelFeedSubmissions(self,
                              submissions=None,
                              feed_types=None,
                              from_date=None,
                              to_date=None,
                              all_submissions=None,
                              debug=None):
        """
		Requests all Feed Submissions that match the specified criteria to
		be cancelled.

		.. NOTE:: Only feeds that have been submitted but have not yet been
		   processed can be cancelled (i.e., where status is "_SUBMITTED_").

		To delete specific Feed Submissions, set *submissions*:

		*submissions* (**sequence**) contains the ID (``str``) of each Feed
		Submission to cancel.

		To delete Feed Submissions based upon a query, use any of the
		following: *feed_types*, *from_date*, *to_date*.

		*feed_types* (**sequence**) contains each Feed Type (``str``) to
		filter the list of submissions to cancel. This can contain any of
		the keys and values from ``FEED_TYPES``. Default is ``None`` for all
		Feed Types.

		*from_date* (``datetime.datetime`` or ``float``) is the earliest
		date to filter the list of submissions to cancel. Default is
		``None`` for 180 days ago.

		*to_date* (``datetime.datetime`` or ``float``) is the latest date to
		filter the list of submissions to cancel. Default is ``None`` for
		now.

		To delete all Feed Submissions, set *all_submissions* to ``True``:

		*all_submissions* (``bool``) indicates whether all Feed Submissions
		should be deleted (``True``), or not (``False``). This is used to
		prevent accidental deletion of all Feed Submissions.

		Returns the response XML (``str``).
		"""
        cancel_list = 1 if submissions is not None else 0
        cancel_query = 1 if (feed_types is not None or from_date is not None
                             or to_date is not None) else 0
        cancel_all = 1 if all_submissions else 0
        cancel_sum = cancel_list + cancel_query + cancel_all
        if cancel_sum != 1:
            if cancel_sum:
                msg = []
                if cancel_list:
                    msg.append("submissions:{subs!r}")
                if cancel_query:
                    msg.append(
                        "a query (feed_types:{types!r}, from_date:{from_date!r}, and to_date:{to_date!r})"
                    )
                if cancel_all:
                    msg.append("all_submissions:{all_subs!r}")
                msg = "Only one of {} can be set.".format(", or ".join(msg))
            else:
                msg = "Either submissions:{subs!r}, or a query (feed_types:{types!r}, from_date:{from_date!r}, and to_date:{to_date!r}), or all_submissions:{all_subs!r} must be set."

            raise ValueError(
                msg.format(subs=submissions,
                           types=feed_types,
                           to_date=to_date,
                           from_date=from_date,
                           all_subs=all_submissions))

        # Build args.
        args = self.new_args()
        args['Action'] = 'CancelFeedSubmissions'

        if submissions is not None:
            args.update(submission_args(submissions, name='submissions'))

        if feed_types is not None:
            args.update(feed_type_args(feed_types, name='feed_types'))

        if from_date is not None:
            args['SubmittedFromDate'] = datetime_to_iso8601(from_date,
                                                            name='from_date')

        if to_date is not None:
            args['SubmittedToDate'] = datetime_to_iso8601(to_date,
                                                          name='to_date')

        # Send request.
        return self.send_request(args, debug=debug)
Exemple #24
0
    def GetFeedSubmissionList(self,
                              submissions=None,
                              count=None,
                              feed_types=None,
                              statuses=None,
                              from_date=None,
                              to_date=None,
                              debug=None):
        """
		Requests for the list of Feed Submissions that match the specified
		criteria.

		To list only specific Feed Submissions, set *submissions*.

		*submissions* (**sequence**) contains the ID (``str``) of each Feed
		Submission to list.

		To list Feed Submissions based upon a query, use the following:

		*count* (``int``) is the maximum number of Feed Submissions to
		list. This cannot exceed 100. Default is ``None`` for 10.

		*feed_types* (**sequence**) contains each Feed Type (``str``) to
		filter the list of submissions to list. This can contain any of the
		keys or values in ``FEED_TYPES``. Default is ``None`` for all Feed
		Types.

		*statuses* (**sequence**) contains each Processing Status
		(``str``) to filter the list of submissions to count. This can
		contain any of the keys or values from ``PROCESSING_STATUSES``.
		Default is ``None`` for all Processing Statuses.

		*from_date* (``datetime.datetime`` or ``float``) is the earliest
		date to filter the list of submissions to count. Default is
		``None`` for 180 days ago.

		*to_date* (``datetime.datetime`` or ``float``) is the latest date to
		filter the list of submissions to cancel. count is ``None`` for
		now.

		Returns the response XML (``str``).
		"""
        if submissions is not None and (count is not None or feed_types
                                        is not None or statuses is not None
                                        or from_date is not None
                                        or to_date is not None):
            raise ValueError(
                "Only submissions:{subs!r}, or a query (count:{count!r}, feed_types:{feed_types!r}, statuses:{statuses!r}, from_date:{from_date!r}, and to_date:{to_date!r}) can be set."
                .format(subs=submissions,
                        count=count,
                        feed_types=feed_types,
                        statuses=statuses,
                        from_date=from_date,
                        to_date=to_date))

        # Build args.
        args = self.new_args()
        args['Action'] = 'GetFeedSubmissionList'

        if submissions is not None:
            args.update(submission_args(submissions, name='submissions'))

        if count is not None:
            if not isinstance(count, six.integer_types):
                raise TypeError("count:{!r} is not an integer.".format(count))
            elif count < 1 or 100 < count:
                raise ValueError(
                    "count:{!r} is not between 1 and 100 inclusive.".format(
                        count))
            args['MaxCount'] = str(count)

        if feed_types is not None:
            args.update(feed_type_args(feed_types, name='feed_types'))

        if statuses is not None:
            args.update(status_args(statuses, name='statuses'))

        if from_date is not None:
            args['SubmittedFromDate'] = datetime_to_iso8601(from_date,
                                                            name='from_date')

        if to_date is not None:
            args['SubmittedToDate'] = datetime_to_iso8601(to_date,
                                                          name='to_date')

        # Send request.
        return self.send_request(args, debug=debug)
	def get_report_request_list(self, requests=None, max_count=None, report_types=None, statuses=None, from_date=None, to_date=None, marketplaces=None, debug=None):
		"""
		Requests for the list of Report Requests that match the query.
		
		To list Report Requests based upon ID use *requests*.
		
		*requests* (**sequence**) is used to filter on Report Request ID
		(``str``). If not ``None``, no other query arguments will be used
		and only those Report Requests with matching IDs will be returned.
		Default is ``None`` to not use Report Request IDs.
		
		To list Report Requests based upon a query use any combination of
		the following: *max_count*, *report_types*, *statuses*, *from_date*,
		*to_date*, and *marketplaces*.
		
		*max_count* (``int``) is the maximum number of Report Requests to
		return per response. This must between 1 and 100 inclusive. Default
		is 10.
		
		*report_types* (**sequence**) is used to filter on Report Type
		(``str``). This can contain any keys or values from
		``REPORT_TYPES``. Default is ``None`` to not filter on Report Type.
		
		*statuses* (**sequence**) is used to filter on Report Processing
		Status (``str``). This can contain any keys or values from
		``REPORT_STATUSES``. Default is ``None`` to not filter on Report
		Processing Status.
		
		*from_date* (``datetime`` or ``float``) is the start of the date
		range to use for selecting Report Requests. Default is ``None`` for
		90 days ago.
		
		*to_date* (``datetime`` or ``float``) is the end of the date range
		to use for selecting Report Requests. Default is ``None`` for now.
		
		*marketplaces* (**sequence**) is the list of Amazon Marketplace IDs
		(``str``). Default is ``None`` for all marketplaces.
		
		Returns the raw XML response (``str``).
		"""
		if max_count is not None:
			if not isinstance(max_count, (int, long)):
				raise TypeError("max_count:{!r} is not an int.".format(max_count))
			elif max_count < 1 or 100 < max_count:
				raise ValueError("max_count:{!r} is not between 1 and 100 inclusive.".format(max_count))
				
		if from_date is not None:
			from_date = datetime_to_iso8601(from_date, name='from_date')
		
		if to_date is not None:
			to_date = datetime_to_iso8601(to_date, name='to_date')
			
		# Build args.
		args = self.new_args()
		args['Action'] = 'GetReportRequestList'
		
		if requests:
			args.update(request_args(requests, name='requests'))
				
		else:
			if max_count:
				args['MaxCount'] = max_count
			
			if report_types is not None:
				args.update(report_type_args(report_types, name='report_types'))
					
			if statuses is not None:
				args.update(status_args(statuses, name='statuses'))
					
			if from_date:
				args['RequestedFromDate'] = from_date
				
			if to_date:
				args['RequestedToDate'] = to_date
				
			if marketplaces is not None:
				args.update(marketplace_args(marketplaces, name='marketplaces'))
		
		# Send request.
		return self.send_request(args, debug=debug)
Exemple #26
0
	def get_report_list(self, requests=None, max_count=None, report_types=None, acknowledged=None, from_date=None, to_date=None, marketplaces=None, debug=None):
		"""
		Lists the Reports that match the query.
		
		To list Reports based upon Request ID use *requests*.
		
		*requests* (**sequence**) is used to filter on Report Request ID
		(``str``). If not ``None``, no other query arguments will be used
		and only those Report Requests with matching IDs will be returned.
		Default is ``None`` to not use Report Request IDs.
		
		To list Reports based upon a query use any combination of the
		following: *max_count*, *report_types*, *acknowledged*, *from_date*,
		*to_date*, and *marketplaces*.
		
		*max_count* (``int``) is the maximum number of Reports to return per
		response. This must between 1 and 100 inclusive. Default is 10.
		
		*report_types* (**sequence**) is used to filter on Report Type
		(``str``). This can contain any keys or values from
		``REPORT_TYPES``. Default is ``None`` to not filter on Report Type.
		
		*acknowledged* (``bool``) is used to filter on whether Order Reports
		have been acknowledged (``True``), or not (``False``). Default is
		``None`` to not filter on Acknowledged state.
		
		.. NOTE:: Setting *acknowledged* to ``True`` will result in only
		   Order Reports (not Listing Reports) being returned.
		
		*from_date* (``datetime`` or ``float``) is the start of the date
		range to use for selecting Report Requests. Default is ``None`` for
		90 days ago.
		
		*to_date* (``datetime`` or ``float``) is the end of the date range
		to use for selecting Report Requests. Default is ``None`` for now.
		
		*marketplaces* (**sequence**) is the list of Amazon Marketplace IDs
		(``str``). Default is ``None`` for all marketplaces.
		
		Returns the raw XML response (``str``).
		"""
		if max_count is not None:
			if not isinstance(max_count, six.integer_types):
				raise TypeError("max_count:{!r} is not an int.".format(max_count))
			elif max_count < 1 or 100 < max_count:
				raise ValueError("max_count:{!r} is not between 1 and 100 inclusive.".format(max_count))
				
		if acknowledged is not None:
			acknowledged = bool(acknowledged)
			
		if from_date is not None:
			from_date = datetime_to_iso8601(from_date, name='from_date')
			
		if to_date is not None:
			to_date = datetime_to_iso8601(to_date, name='to_date')
			
		# Build args.
		args = self.new_args()
		args['Action'] = 'GetReportList'
		
		if requests:
			args.update(request_args(requests, name='requests'))
				
		else:
			if max_count:
				args['MaxCount'] = max_count
		
			if report_types is not None:
				args.update(report_type_args(report_types, name='report_types'))
					
			if acknowledged is not None:
				args['Acknowledged'] = 'true' if acknowledged else 'false'
				
			if from_date:
				args['RequestedFromDate'] = from_date
				
			if to_date:
				args['RequestedToDate'] = to_date
				
			if marketplaces is not None:
				args.update(marketplace_args(marketplaces, name='marketplaces'))
		
		# Send request.
		return self.send_request(args, debug=debug)
    def get_report_list(self,
                        requests=None,
                        max_count=None,
                        report_types=None,
                        acknowledged=None,
                        from_date=None,
                        to_date=None,
                        marketplaces=None,
                        debug=None):
        """
		Lists the Reports that match the query.
		
		To list Reports based upon Request ID use *requests*.
		
		*requests* (**sequence**) is used to filter on Report Request ID
		(``str``). If not ``None``, no other query arguments will be used
		and only those Report Requests with matching IDs will be returned.
		Default is ``None`` to not use Report Request IDs.
		
		To list Reports based upon a query use any combination of the
		following: *max_count*, *report_types*, *acknowledged*, *from_date*,
		*to_date*, and *marketplaces*.
		
		*max_count* (``int``) is the maximum number of Reports to return per
		response. This must between 1 and 100 inclusive. Default is 10.
		
		*report_types* (**sequence**) is used to filter on Report Type
		(``str``). This can contain any keys or values from
		``REPORT_TYPES``. Default is ``None`` to not filter on Report Type.
		
		*acknowledged* (``bool``) is used to filter on whether Order Reports
		have been acknowledged (``True``), or not (``False``). Default is
		``None`` to not filter on Acknowledged state.
		
		.. NOTE:: Setting *acknowledged* to ``True`` will result in only
		   Order Reports (not Listing Reports) being returned.
		
		*from_date* (``datetime`` or ``float``) is the start of the date
		range to use for selecting Report Requests. Default is ``None`` for
		90 days ago.
		
		*to_date* (``datetime`` or ``float``) is the end of the date range
		to use for selecting Report Requests. Default is ``None`` for now.
		
		*marketplaces* (**sequence**) is the list of Amazon Marketplace IDs
		(``str``). Default is ``None`` for all marketplaces.
		
		Returns the raw XML response (``str``).
		"""
        if max_count is not None:
            if not isinstance(max_count, six.integer_types):
                raise TypeError(
                    "max_count:{!r} is not an int.".format(max_count))
            elif max_count < 1 or 100 < max_count:
                raise ValueError(
                    "max_count:{!r} is not between 1 and 100 inclusive.".
                    format(max_count))

        if acknowledged is not None:
            acknowledged = bool(acknowledged)

        if from_date is not None:
            from_date = datetime_to_iso8601(from_date, name='from_date')

        if to_date is not None:
            to_date = datetime_to_iso8601(to_date, name='to_date')

        # Build args.
        args = self.new_args()
        args['Action'] = 'GetReportList'

        if requests:
            args.update(request_args(requests, name='requests'))

        else:
            if max_count:
                args['MaxCount'] = max_count

            if report_types is not None:
                args.update(report_type_args(report_types,
                                             name='report_types'))

            if acknowledged is not None:
                args['Acknowledged'] = 'true' if acknowledged else 'false'

            if from_date:
                args['RequestedFromDate'] = from_date

            if to_date:
                args['RequestedToDate'] = to_date

            if marketplaces is not None:
                args.update(marketplace_args(marketplaces,
                                             name='marketplaces'))

        # Send request.
        return self.send_request(args, debug=debug)