fmslist 0.0.3__py3-none-any.whl → 0.0.5__py3-none-any.whl

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.
fmslist/scraper.py CHANGED
@@ -17,6 +17,7 @@ class Variant:
17
17
  price: str
18
18
  available: bool
19
19
  quantity: int
20
+ created_at: datetime
20
21
 
21
22
 
22
23
  @dataclass(frozen=True)
@@ -28,8 +29,9 @@ class ItemDetails:
28
29
  vendor: str
29
30
  image_urls: list[str]
30
31
  link: str
32
+ product_type: str
31
33
  published_at: datetime
32
- updated_at: datetime
34
+ created_at: datetime
33
35
  variants: list[Variant]
34
36
 
35
37
 
@@ -116,8 +118,9 @@ class FindMeStoreList:
116
118
  vendor = product.get("vendor", "Unknown Vendor")
117
119
  image_urls = [image["src"] for image in product.get("images", [])]
118
120
  link = f"{self._base_url}/products/{product['handle']}"
121
+ product_type = product.get("product_type", "Unknown Type")
119
122
  published_at = self._parse_timestamp(product["published_at"])
120
- updated_at = self._parse_timestamp(product["updated_at"])
123
+ created_at = self._parse_timestamp(product["created_at"])
121
124
  variants = [
122
125
  Variant(
123
126
  id=variant["id"],
@@ -125,11 +128,20 @@ class FindMeStoreList:
125
128
  price=variant["price"],
126
129
  available=variant["available"],
127
130
  quantity=0,
131
+ created_at=self._parse_timestamp(variant["created_at"]),
128
132
  )
129
133
  for variant in product.get("variants", [])
130
134
  ]
131
135
  return ItemDetails(
132
- id, title, vendor, image_urls, link, published_at, updated_at, variants
136
+ id,
137
+ title,
138
+ vendor,
139
+ image_urls,
140
+ link,
141
+ product_type,
142
+ published_at,
143
+ created_at,
144
+ variants,
133
145
  )
134
146
 
135
147
  def _fetch_products(self, page: int) -> list[ItemDetails]:
@@ -149,3 +161,26 @@ class FindMeStoreList:
149
161
  )
150
162
  products = res.json().get("products", [])
151
163
  return [self._parse_product(product) for product in products]
164
+
165
+
166
+ if __name__ == "__main__":
167
+ fms = FindMeStoreList()
168
+ fms.fetch_items()
169
+ fms.fill_quantities()
170
+
171
+ # Print item details
172
+ for item in fms.items:
173
+ print(
174
+ f"Item ID: {item.id}, Title: {item.title}, Vendor: {item.vendor}, Product Type: {item.product_type}"
175
+ )
176
+ print(f"Published at: {item.published_at}, Created at: {item.created_at}")
177
+ print(f"Link: {item.link}")
178
+ print("Variants:")
179
+ for variant in item.variants:
180
+ print(f" - Variant ID: {variant.id}")
181
+ print(f" Name: {variant.name}, Price: {variant.price}")
182
+ print(f" Available: {variant.available}, Quantity: {variant.quantity}")
183
+ print(f" Created at: {variant.created_at}")
184
+ print()
185
+
186
+ print(f"Total items fetched: {len(fms.items)}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fmslist
3
- Version: 0.0.3
3
+ Version: 0.0.5
4
4
  Summary: A web scraper that lists items from Findmestore.
5
5
  Project-URL: Homepage, https://github.com/d4n1elchen/fmslist
6
6
  Project-URL: Issues, https://github.com/d4n1elchen/fmslist/issues
@@ -0,0 +1,6 @@
1
+ fmslist/__init__.py,sha256=LvCLbFusopU82bfaLvjmc_TnJJereamdRlo0diCSOlc,23
2
+ fmslist/scraper.py,sha256=zyZ3D5VVsRK1zXPbpyF9DgbVek85UgJ_67B7vwVI7GI,6372
3
+ fmslist-0.0.5.dist-info/METADATA,sha256=fyl4PLpHQ1UpSSF9InLSUa959dEMGaXDO_0glkFZnbo,394
4
+ fmslist-0.0.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
5
+ fmslist-0.0.5.dist-info/licenses/LICENSE,sha256=ACwmltkrXIz5VsEQcrqljq-fat6ZXAMepjXGoe40KtE,1069
6
+ fmslist-0.0.5.dist-info/RECORD,,
@@ -1,6 +0,0 @@
1
- fmslist/__init__.py,sha256=LvCLbFusopU82bfaLvjmc_TnJJereamdRlo0diCSOlc,23
2
- fmslist/scraper.py,sha256=0M3DgfGI9NpaJb7GsWWvLsL2bU-SIyUe_SMs7eAxYQc,5257
3
- fmslist-0.0.3.dist-info/METADATA,sha256=A0nfMgto5vg9jyLd85AtFKTFG1T4K_sQOUin_LayRJY,394
4
- fmslist-0.0.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
5
- fmslist-0.0.3.dist-info/licenses/LICENSE,sha256=ACwmltkrXIz5VsEQcrqljq-fat6ZXAMepjXGoe40KtE,1069
6
- fmslist-0.0.3.dist-info/RECORD,,