Skip to content

How to filter Finances.list_financial_events by Marketplace? It returns too many pages in this function. #293

Answered by saleweaver
paulabirocchi asked this question in Q&A
Discussion options

You must be logged in to vote

The endpoint doesn't have a Marketplace parameter. list_financial_events

I don't understand why you're using a range to loop. Also, if you want to request by NextToken, you only pass NextToken usually, nothing else. You might find the load_all_pages and retry decorators useful, the do what you want: https://sp-api-docs.saleweaver.com/utils/load_all_pages/

@throttle_retry()
@load_all_pages()
def get_financial_events(**kwargs):
    return Finances().list_financial_events(**kwargs)

for page in get_financial_events(PostedAfter='2021-05-10', PostedBefore='2021-05-11', MaxResultsPerPage=100):
    for event in page.payload.get('FinancialEvents').get('ShipmentEventList'):
        print(event)


Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by paulabirocchi
Comment options

You must be logged in to vote
3 replies
@saleweaver
Comment options

@paulabirocchi
Comment options

@saleweaver
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants