etsy-python 1.2.3__tar.gz → 1.2.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. {etsy_python-1.2.3/etsy_python.egg-info → etsy_python-1.2.4}/PKG-INFO +1 -1
  2. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/_version.py +1 -1
  3. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/common/Utils.py +16 -1
  4. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/resources/Listing.py +11 -8
  5. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/resources/Payment.py +3 -2
  6. {etsy_python-1.2.3 → etsy_python-1.2.4/etsy_python.egg-info}/PKG-INFO +1 -1
  7. {etsy_python-1.2.3 → etsy_python-1.2.4}/LICENSE +0 -0
  8. {etsy_python-1.2.3 → etsy_python-1.2.4}/MANIFEST.in +0 -0
  9. {etsy_python-1.2.3 → etsy_python-1.2.4}/README.md +0 -0
  10. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/__init__.py +0 -0
  11. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/__init__.py +0 -0
  12. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/auth/OAuth.py +0 -0
  13. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/auth/__init__.py +0 -0
  14. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/common/Env.py +0 -0
  15. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/common/Request.py +0 -0
  16. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/common/__init__.py +0 -0
  17. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/enums/HolidayPreferences.py +0 -0
  18. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/enums/Language.py +0 -0
  19. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/enums/Listing.py +0 -0
  20. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/enums/ListingInventory.py +0 -0
  21. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/enums/ProcessingProfile.py +0 -0
  22. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/enums/ShippingProfile.py +0 -0
  23. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/enums/ShopReceipt.py +0 -0
  24. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/enums/__init__.py +0 -0
  25. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/exceptions/BaseAPIException.py +0 -0
  26. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/exceptions/RequestException.py +0 -0
  27. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/exceptions/__init__.py +0 -0
  28. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/models/FileRequest.py +0 -0
  29. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/models/HolidayPreferences.py +0 -0
  30. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/models/Listing.py +0 -0
  31. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/models/Miscellaneous.py +0 -0
  32. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/models/ProcessingProfile.py +0 -0
  33. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/models/Product.py +0 -0
  34. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/models/Receipt.py +0 -0
  35. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/models/Request.py +0 -0
  36. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/models/ShippingProfile.py +0 -0
  37. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/models/Shop.py +0 -0
  38. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/models/ShopReturnPolicy.py +0 -0
  39. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/models/Utils.py +0 -0
  40. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/models/__init__.py +0 -0
  41. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/resources/HolidayPreferences.py +0 -0
  42. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/resources/ListingFile.py +0 -0
  43. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/resources/ListingImage.py +0 -0
  44. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/resources/ListingInventory.py +0 -0
  45. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/resources/ListingOffering.py +0 -0
  46. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/resources/ListingProduct.py +0 -0
  47. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/resources/ListingTranslation.py +0 -0
  48. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/resources/ListingVariationImages.py +0 -0
  49. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/resources/ListingVideo.py +0 -0
  50. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/resources/Miscellaneous.py +0 -0
  51. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/resources/PaymentLedgerEntry.py +0 -0
  52. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/resources/ProcessingProfile.py +0 -0
  53. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/resources/Receipt.py +0 -0
  54. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/resources/ReceiptTransactions.py +0 -0
  55. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/resources/Response.py +0 -0
  56. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/resources/Review.py +0 -0
  57. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/resources/Session.py +0 -0
  58. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/resources/ShippingProfile.py +0 -0
  59. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/resources/Shop.py +0 -0
  60. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/resources/ShopProductionPartner.py +0 -0
  61. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/resources/ShopReturnPolicy.py +0 -0
  62. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/resources/ShopSection.py +0 -0
  63. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/resources/Taxonomy.py +0 -0
  64. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/resources/User.py +0 -0
  65. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/resources/UserAddress.py +0 -0
  66. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/resources/__init__.py +0 -0
  67. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/resources/enums/RateLimit.py +0 -0
  68. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/resources/enums/Request.py +0 -0
  69. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python/v3/resources/enums/__init__.py +0 -0
  70. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python.egg-info/SOURCES.txt +0 -0
  71. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python.egg-info/dependency_links.txt +0 -0
  72. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python.egg-info/requires.txt +0 -0
  73. {etsy_python-1.2.3 → etsy_python-1.2.4}/etsy_python.egg-info/top_level.txt +0 -0
  74. {etsy_python-1.2.3 → etsy_python-1.2.4}/setup.cfg +0 -0
  75. {etsy_python-1.2.3 → etsy_python-1.2.4}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: etsy-python
3
- Version: 1.2.3
3
+ Version: 1.2.4
4
4
  Summary: Etsy API Client Library for Python
5
5
  Author: Amit Ray
6
6
  Author-email: mail@amitray.dev
@@ -1,3 +1,3 @@
1
1
  """Version information for etsy-python package."""
2
2
 
3
- __version__ = "1.2.3"
3
+ __version__ = "1.2.4"
@@ -1,6 +1,6 @@
1
1
  import warnings
2
2
  from enum import Enum
3
- from typing import Any, Dict, List, Optional
3
+ from typing import Any, Dict, Iterable, List, Optional
4
4
 
5
5
 
6
6
  def warn_removed_legacy_param(operation_id: str) -> None:
@@ -25,6 +25,21 @@ def warn_removed_legacy_param(operation_id: str) -> None:
25
25
  )
26
26
 
27
27
 
28
+ def join_ids(name: str, ids: Iterable[Any]) -> str:
29
+ """Join a required list of IDs into Etsy's comma-separated query value.
30
+
31
+ Raises ``TypeError`` for a string (iterating it would split the ID into
32
+ characters) and ``ValueError`` when no IDs are given, so a request Etsy
33
+ would reject is caught before it is sent.
34
+ """
35
+ if isinstance(ids, (str, bytes)):
36
+ raise TypeError(f"{name} must be a list of IDs, not a string")
37
+ joined = ",".join(map(str, ids)) if ids is not None else ""
38
+ if not joined:
39
+ raise ValueError(f"{name} is required and must contain at least one ID")
40
+ return joined
41
+
42
+
28
43
  def generate_get_uri(uri: str, params: Optional[Dict[str, Any]] = None) -> str:
29
44
  if not params:
30
45
  return uri
@@ -2,7 +2,7 @@ import warnings
2
2
  from dataclasses import dataclass
3
3
  from typing import Optional, List, Dict, Any, Union
4
4
 
5
- from etsy_python.v3.common.Utils import warn_removed_legacy_param
5
+ from etsy_python.v3.common.Utils import join_ids, warn_removed_legacy_param
6
6
  from etsy_python.v3.enums.Listing import Includes, State, SortOn, SortOrder
7
7
  from etsy_python.v3.exceptions.RequestException import RequestException
8
8
  from etsy_python.v3.models.Listing import (
@@ -150,7 +150,7 @@ class ListingResource:
150
150
  ) -> Union[Response, RequestException]:
151
151
  endpoint = "/listings/batch"
152
152
  query_params: Dict[str, Any] = {
153
- "listing_ids": ",".join(list(map(str, listing_ids))),
153
+ "listing_ids": join_ids("listing_ids", listing_ids),
154
154
  "includes": ",".join(list(map(lambda inc: inc.value, includes)))
155
155
  if includes is not None
156
156
  else None,
@@ -179,7 +179,7 @@ class ListingResource:
179
179
  ) -> Union[Response, RequestException]:
180
180
  endpoint = "/listings/batch/inventory"
181
181
  query_params: Dict[str, Any] = {
182
- "listing_ids": ",".join(list(map(str, listing_ids))),
182
+ "listing_ids": join_ids("listing_ids", listing_ids),
183
183
  }
184
184
  return self.session.make_request(endpoint, query_params=query_params)
185
185
 
@@ -188,7 +188,7 @@ class ListingResource:
188
188
  ) -> Union[Response, RequestException]:
189
189
  endpoint = "/listings/batch/shipping"
190
190
  query_params: Dict[str, Any] = {
191
- "listing_ids": ",".join(list(map(str, listing_ids))),
191
+ "listing_ids": join_ids("listing_ids", listing_ids),
192
192
  }
193
193
  return self.session.make_request(endpoint, query_params=query_params)
194
194
 
@@ -260,18 +260,21 @@ class ListingResource:
260
260
  def get_listings_by_shop_section_id(
261
261
  self,
262
262
  shop_id: int,
263
- shop_section_ids: Optional[List[int]] = None,
263
+ shop_section_ids: List[int],
264
264
  limit: int = 25,
265
265
  offset: int = 0,
266
266
  sort_on: SortOn = SortOn.CREATED,
267
267
  sort_order: SortOrder = SortOrder.DESC,
268
268
  legacy: Optional[bool] = None,
269
269
  ) -> Union[Response, RequestException]:
270
+ """Get listings in the given shop sections.
271
+
272
+ Raises ``ValueError`` if ``shop_section_ids`` is empty and
273
+ ``TypeError`` if it is a string, before any request is sent.
274
+ """
270
275
  endpoint = f"/shops/{shop_id}/shop-sections/listings"
271
276
  query_params: Dict[str, Any] = {
272
- "shop_section_ids": ",".join(list(map(str, shop_section_ids)))
273
- if shop_section_ids is not None
274
- else None,
277
+ "shop_section_ids": join_ids("shop_section_ids", shop_section_ids),
275
278
  "limit": limit,
276
279
  "offset": offset,
277
280
  "sort_on": sort_on.value,
@@ -2,6 +2,7 @@ import warnings
2
2
  from dataclasses import dataclass
3
3
  from typing import Union, Dict, Any, List
4
4
 
5
+ from etsy_python.v3.common.Utils import join_ids
5
6
  from etsy_python.v3.exceptions.RequestException import RequestException
6
7
  from etsy_python.v3.resources.Session import EtsyClient
7
8
  from etsy_python.v3.resources.Response import Response
@@ -16,7 +17,7 @@ class PaymentResource:
16
17
  ) -> Union[Response, RequestException]:
17
18
  endpoint = f"/shops/{shop_id}/payment-account/ledger-entries/payments"
18
19
  query_params: Dict[str, Any] = {
19
- "ledger_entry_ids": ",".join(list(map(str, ledger_entry_ids)))
20
+ "ledger_entry_ids": join_ids("ledger_entry_ids", ledger_entry_ids)
20
21
  }
21
22
  return self.session.make_request(endpoint, query_params=query_params)
22
23
 
@@ -42,5 +43,5 @@ class PaymentResource:
42
43
  self, shop_id: int, payment_ids: List[int]
43
44
  ) -> Union[Response, RequestException]:
44
45
  endpoint = f"/shops/{shop_id}/payments"
45
- query_params: Dict[str, Any] = {"payment_ids": ",".join(list(map(str, payment_ids)))}
46
+ query_params: Dict[str, Any] = {"payment_ids": join_ids("payment_ids", payment_ids)}
46
47
  return self.session.make_request(endpoint, query_params=query_params)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: etsy-python
3
- Version: 1.2.3
3
+ Version: 1.2.4
4
4
  Summary: Etsy API Client Library for Python
5
5
  Author: Amit Ray
6
6
  Author-email: mail@amitray.dev
File without changes
File without changes
File without changes
File without changes
File without changes