keepa 1.3.8__tar.gz → 1.3.9__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: keepa
3
- Version: 1.3.8
3
+ Version: 1.3.9
4
4
  Summary: Interfaces with keepa.com's API.
5
5
  Keywords: keepa
6
6
  Author-email: Alex Kaszynski <akascap@gmail.com>
@@ -17,9 +17,8 @@ Classifier: Programming Language :: Python :: 3.12
17
17
  Requires-Dist: numpy >=1.9.3
18
18
  Requires-Dist: requests >=2.2
19
19
  Requires-Dist: tqdm
20
- Requires-Dist: aiohttp; python_version!='3.12.*'
21
- Requires-Dist: aiohttp==3.9.0b0; python_version=='3.12.*'
22
- Requires-Dist: pandas
20
+ Requires-Dist: aiohttp
21
+ Requires-Dist: pandas <= 3.0
23
22
  Requires-Dist: sphinx==6.1.2 ; extra == "doc"
24
23
  Requires-Dist: pydata-sphinx-theme==0.14.2 ; extra == "doc"
25
24
  Requires-Dist: matplotlib ; extra == "test"
@@ -328,7 +327,6 @@ Unit testing will automatically enforce minimum code coverage standards.
328
327
 
329
328
  Next, to ensure your code meets minimum code styling standards, run::
330
329
 
331
- pip install pre-commit
332
330
  pre-commit run --all-files
333
331
 
334
332
  Finally, `create a pull request`_ from your fork and I'll be sure to review it.
@@ -294,7 +294,6 @@ Unit testing will automatically enforce minimum code coverage standards.
294
294
 
295
295
  Next, to ensure your code meets minimum code styling standards, run::
296
296
 
297
- pip install pre-commit
298
297
  pre-commit run --all-files
299
298
 
300
299
  Finally, `create a pull request`_ from your fork and I'll be sure to review it.
@@ -26,9 +26,8 @@ dependencies = [
26
26
  "numpy >=1.9.3",
27
27
  "requests >=2.2",
28
28
  "tqdm",
29
- "aiohttp; python_version!='3.12.*'",
30
- "aiohttp==3.9.0b0; python_version=='3.12.*'", # until aiohttp gets upgraded
31
- "pandas",
29
+ "aiohttp",
30
+ "pandas <= 3.0",
32
31
  ]
33
32
 
34
33
  [project.urls]
@@ -61,10 +60,5 @@ combine_as_imports = true
61
60
 
62
61
  [tool.ruff]
63
62
  line-length = 100
64
-
65
- [tool.ruff.lint]
66
- # Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
67
- # Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
68
- # McCabe complexity (`C901`) by default.
69
- select = ["E4", "E7", "E9", "F"]
63
+ select = ["E", "F", "W", "I001"] # pyflakes, pycodestyle, isort
70
64
  ignore = []
@@ -1,6 +1,6 @@
1
1
  """Keepaapi module."""
2
2
 
3
- __version__ = "1.3.8"
3
+ __version__ = "1.3.9"
4
4
  from keepa.interface import ( # noqa: F401
5
5
  DCODES,
6
6
  KEEPA_ST_ORDINAL,
@@ -1,4 +1,5 @@
1
1
  """Interface module to download Amazon product and history data from keepa.com."""
2
+
2
3
  import asyncio
3
4
  import datetime
4
5
  import json
@@ -43,8 +44,8 @@ SCODES = {
43
44
 
44
45
  # domain codes
45
46
  # Valid values: [ 1: com | 2: co.uk | 3: de | 4: fr | 5:
46
- # co.jp | 6: ca | 7: cn | 8: it | 9: es | 10: in | 11: com.mx ]
47
- DCODES = ["RESERVED", "US", "GB", "DE", "FR", "JP", "CA", "CN", "IT", "ES", "IN", "MX"]
47
+ # co.jp | 6: ca | 7: cn | 8: it | 9: es | 10: in | 11: com.mx | 12: com.br ]
48
+ DCODES = ["RESERVED", "US", "GB", "DE", "FR", "JP", "CA", "CN", "IT", "ES", "IN", "MX", "BR"]
48
49
 
49
50
  # csv indices. used when parsing csv and stats fields.
50
51
  # https://github.com/keepacom/api_backend
@@ -505,9 +506,9 @@ class Keepa:
505
506
  timestamps (unix epoch time milliseconds) or two date
506
507
  strings (ISO8601, with or without time in UTC).
507
508
 
508
- domain : str, optional
509
+ domain : str, default: "US"
509
510
  One of the following Amazon domains: RESERVED, US, GB, DE,
510
- FR, JP, CA, CN, IT, ES, IN, MX Defaults to US.
511
+ FR, JP, CA, CN, IT, ES, IN, MX, BR.
511
512
 
512
513
  offers : int, optional
513
514
  Adds available offers to product data. Default 0. Must be between
@@ -885,7 +886,7 @@ class Keepa:
885
886
 
886
887
  domain : str
887
888
  One of the following Amazon domains:
888
- RESERVED, US, GB, DE, FR, JP, CA, CN, IT, ES, IN, MX
889
+ RESERVED, US, GB, DE, FR, JP, CA, CN, IT, ES, IN, MX, BR.
889
890
 
890
891
  offers : bool, optional
891
892
  Adds product offers to product data.
@@ -1021,10 +1022,9 @@ class Keepa:
1021
1022
  the best sellers list for. You can find category node ids
1022
1023
  via the category search "search_for_categories".
1023
1024
 
1024
- domain : str
1025
- Amazon locale you want to access. Must be one of the following
1026
- RESERVED, US, GB, DE, FR, JP, CA, CN, IT, ES, IN, MX
1027
- Default US.
1025
+ domain : str, default: "US"
1026
+ Amazon locale you want to access. Must be one of the following:
1027
+ RESERVED, US, GB, DE, FR, JP, CA, CN, IT, ES, IN, MX, BR.
1028
1028
 
1029
1029
  wait : bool, optional
1030
1030
  Wait available token before doing effective query.
@@ -1077,7 +1077,10 @@ class Keepa:
1077
1077
  ...
1078
1078
 
1079
1079
  """
1080
- assert domain in DCODES, "Invalid domain code"
1080
+ if domain not in DCODES:
1081
+ raise ValueError(
1082
+ f"Invalid domain code {domain}. Should be one of the following:\n{DCODES}"
1083
+ )
1081
1084
 
1082
1085
  payload = {
1083
1086
  "key": self.accesskey,
@@ -1100,10 +1103,9 @@ class Keepa:
1100
1103
  searchterm : str
1101
1104
  Input search term.
1102
1105
 
1103
- domain : str, default: 'US'
1104
- Amazon locale you want to access. Must be one of the following
1105
- RESERVED, US, GB, DE, FR, JP, CA, CN, IT, ES, IN, MX
1106
- Default US.
1106
+ domain : str, default: "US"
1107
+ Amazon locale you want to access. Must be one of the following:
1108
+ RESERVED, US, GB, DE, FR, JP, CA, CN, IT, ES, IN, MX, BR.
1107
1109
 
1108
1110
  wait : bool, default: True
1109
1111
  Wait available token before doing effective query.
@@ -1136,7 +1138,10 @@ class Keepa:
1136
1138
  144 Science Fiction & Fantasy
1137
1139
 
1138
1140
  """
1139
- assert domain in DCODES, "Invalid domain code"
1141
+ if domain not in DCODES:
1142
+ raise ValueError(
1143
+ f"Invalid domain code {domain}. Should be one of the following:\n{DCODES}"
1144
+ )
1140
1145
 
1141
1146
  payload = {
1142
1147
  "key": self.accesskey,
@@ -1162,9 +1167,8 @@ class Keepa:
1162
1167
  categories.
1163
1168
 
1164
1169
  domain : str, default: "US"
1165
- Amazon locale you want to access. Must be one of the following
1166
- RESERVED, US, GB, DE, FR, JP, CA, CN, IT, ES, IN, MX
1167
- Default US
1170
+ Amazon locale you want to access. Must be one of the following:
1171
+ RESERVED, US, GB, DE, FR, JP, CA, CN, IT, ES, IN, MX, BR.
1168
1172
 
1169
1173
  include_parents : bool, default: False
1170
1174
  Include parents.
@@ -1211,7 +1215,9 @@ class Keepa:
1211
1215
 
1212
1216
  """
1213
1217
  if domain not in DCODES:
1214
- raise ValueError("Invalid domain code")
1218
+ raise ValueError(
1219
+ f"Invalid domain code {domain}. Should be one of the following:\n{DCODES}"
1220
+ )
1215
1221
 
1216
1222
  payload = {
1217
1223
  "key": self.accesskey,
@@ -2884,7 +2890,10 @@ class AsyncKeepa:
2884
2890
  @is_documented_by(Keepa.best_sellers_query)
2885
2891
  async def best_sellers_query(self, category, rank_avg_range=0, domain="US", wait=True):
2886
2892
  """Documented by Keepa.best_sellers_query."""
2887
- assert domain in DCODES, "Invalid domain code"
2893
+ if domain not in DCODES:
2894
+ raise ValueError(
2895
+ f"Invalid domain code {domain}. Should be one of the following:\n{DCODES}"
2896
+ )
2888
2897
 
2889
2898
  payload = {
2890
2899
  "key": self.accesskey,
@@ -2902,7 +2911,10 @@ class AsyncKeepa:
2902
2911
  @is_documented_by(Keepa.search_for_categories)
2903
2912
  async def search_for_categories(self, searchterm, domain="US", wait=True):
2904
2913
  """Documented by Keepa.search_for_categories."""
2905
- assert domain in DCODES, "Invalid domain code"
2914
+ if domain not in DCODES:
2915
+ raise ValueError(
2916
+ f"Invalid domain code {domain}. Should be one of the following:\n{DCODES}"
2917
+ )
2906
2918
 
2907
2919
  payload = {
2908
2920
  "key": self.accesskey,
@@ -2922,7 +2934,10 @@ class AsyncKeepa:
2922
2934
  @is_documented_by(Keepa.category_lookup)
2923
2935
  async def category_lookup(self, category_id, domain="US", include_parents=0, wait=True):
2924
2936
  """Documented by Keepa.category_lookup."""
2925
- assert domain in DCODES, "Invalid domain code"
2937
+ if domain not in DCODES:
2938
+ raise ValueError(
2939
+ f"Invalid domain code {domain}. Should be one of the following:\n{DCODES}"
2940
+ )
2926
2941
 
2927
2942
  payload = {
2928
2943
  "key": self.accesskey,
@@ -1,4 +1,5 @@
1
1
  """Plotting module product data returned from keepa interface module."""
2
+
2
3
  import numpy as np
3
4
 
4
5
  from keepa.interface import keepa_minutes_to_time, parse_csv
File without changes