etsyv3
etsyv3 copied to clipboard
Add optional filters to get_shop_receipts()
Do you have a fork with this PR integrated? I would like to use it.
I do not, but you can manually hack this change into your code by either monkeypatching the existing EtsyAPI
class, or by defining a new class that inherits from EtsyAPI
and overwriting the get_shop_receipts
method, like so:
class EtsyAPIPatched(EtsyAPI):
def get_shop_receipts(
self,
shop_id: int,
limit: Optional[int] = None,
offset: Optional[int] = None,
was_paid: bool = True,
was_shipped: bool = False,
was_canceled: Optional[bool] = None,
min_created: Optional[int] = None,
max_created: Optional[int] = None,
min_last_modified: Optional[int] = None,
max_last_modified: Optional[int] = None,
sort_on: Optional[str] = None,
sort_order: Optional[str] = None,
was_delivered: Optional[bool] = None,
) -> Any:
uri = f"{ETSY_API_BASEURL}/shops/{shop_id}/receipts"
kwargs: Dict[str, Any] = {
"limit": limit,
"offset": offset,
"was_paid": was_paid,
"was_shipped": was_shipped,
"was_canceled": was_canceled,
"min_created": min_created,
"max_created": max_created,
"min_last_modified": min_last_modified,
"max_last_modified": max_last_modified,
"sort_on": sort_on,
"sort_order": sort_order,
"was_delivered": was_delivered,
}
return self._issue_request(uri, **kwargs)
Sorry for the delay - been a bit recently. But thanks for your help!