I am trying to use the function below. Mostly when i call this function I just pass in the report_type but a few of the report calls wants a start_date. Questions
Does the None in the definition of function mean that the field is optional
def request_report(self, report_type, start_date=None, end_date=None, marketplaceids=()): data = dict(Action='RequestReport', ReportType=report_type, StartDate=start_date, EndDate=end_date) data.update(utils.enumerate_param('MarketplaceIdList.Id.', marketplaceids)) return self.make_request(data)
I normally call the function with one of the lines below depending on if I am passing a start_date. Other then having a series of 'if' statements for each request type is there a good way to call this function and only pass a specific variable if it is populated? Over time I will be adding more optional parameters and done want a giant 'if' statement
requested_report=report_api.request_report(report_type=report_name, start_date=starting_date) requested_report=report_api.request_report(report_type=report_name)