'Python Requests Passing Array to GET API query
I'm using Amazon's selling partner API to query my inventory. I only want a few SKUs, so I'm trying to send a list using the sellerSkus parameter. Please help me specify the "sellerSkus" parameter correctly.
I'm using python3 and sending the request using:
APIResponse = requests.get(url, params=params, headers=headers, auth=auth)
where url, params, headers and auth are what you'd expect. params has other query parameters, but sellerSkus is the one that's not working. (The url is https://sellingpartnerapi-na.amazon.com/fba/inventory/v1/summaries.)
If I try:
{'sellerSkus': ['SKU1', 'SKU2','SKU3']}
I just get one result back, the last one in the list.
If I try:
{'sellerSkus[]': ['SKU1', 'SKU2','SKU3']}
I get results for all my skus, like it doesn't recognize the parameter.
If I try:
{'sellerSkus': "[SKU1, SKU2,SKU3]"}
I get no results back, like it recognizes the parameter but is treating my list as a single sku that doesn't match.
What am I missing? How do I specify this list so that I get just the skus I need?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
