fmslist 0.0.2__py3-none-any.whl → 0.0.4__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)
@@ -29,7 +30,7 @@ class ItemDetails:
29
30
  image_urls: list[str]
30
31
  link: str
31
32
  published_at: datetime
32
- updated_at: datetime
33
+ created_at: datetime
33
34
  variants: list[Variant]
34
35
 
35
36
 
@@ -117,7 +118,7 @@ class FindMeStoreList:
117
118
  image_urls = [image["src"] for image in product.get("images", [])]
118
119
  link = f"{self._base_url}/products/{product['handle']}"
119
120
  published_at = self._parse_timestamp(product["published_at"])
120
- updated_at = self._parse_timestamp(product["updated_at"])
121
+ created_at = self._parse_timestamp(product["created_at"])
121
122
  variants = [
122
123
  Variant(
123
124
  id=variant["id"],
@@ -125,11 +126,12 @@ class FindMeStoreList:
125
126
  price=variant["price"],
126
127
  available=variant["available"],
127
128
  quantity=0,
129
+ created_at=self._parse_timestamp(variant["created_at"]),
128
130
  )
129
131
  for variant in product.get("variants", [])
130
132
  ]
131
133
  return ItemDetails(
132
- id, title, vendor, image_urls, link, published_at, updated_at, variants
134
+ id, title, vendor, image_urls, link, published_at, created_at, variants
133
135
  )
134
136
 
135
137
  def _fetch_products(self, page: int) -> list[ItemDetails]:
@@ -149,3 +151,24 @@ class FindMeStoreList:
149
151
  )
150
152
  products = res.json().get("products", [])
151
153
  return [self._parse_product(product) for product in products]
154
+
155
+
156
+ if __name__ == "__main__":
157
+ fms = FindMeStoreList()
158
+ fms.fetch_items()
159
+ fms.fill_quantities()
160
+
161
+ # Print item details
162
+ for item in fms.items:
163
+ print(f"Item ID: {item.id}, Title: {item.title}, Vendor: {item.vendor}")
164
+ print(f"Published at: {item.published_at}, Created at: {item.created_at}")
165
+ print(f"Link: {item.link}")
166
+ print("Variants:")
167
+ for variant in item.variants:
168
+ print(f" - Variant ID: {variant.id}")
169
+ print(f" Name: {variant.name}, Price: {variant.price}")
170
+ print(f" Available: {variant.available}, Quantity: {variant.quantity}")
171
+ print(f" Created at: {variant.created_at}")
172
+ print()
173
+
174
+ print(f"Total items fetched: {len(fms.items)}")
@@ -1,13 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fmslist
3
- Version: 0.0.2
3
+ Version: 0.0.4
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
7
7
  License-Expression: MIT
8
8
  License-File: LICENSE
9
9
  Requires-Python: >=3.9
10
- Requires-Dist: bs4
11
10
  Requires-Dist: requests
12
11
  Description-Content-Type: text/markdown
13
12
 
@@ -0,0 +1,6 @@
1
+ fmslist/__init__.py,sha256=LvCLbFusopU82bfaLvjmc_TnJJereamdRlo0diCSOlc,23
2
+ fmslist/scraper.py,sha256=qZkMbT19UZ5_AJuENVLOivxCEoLzleGvcqHZetNShBE,6115
3
+ fmslist-0.0.4.dist-info/METADATA,sha256=97m5oUBbwzvCnN8Fwu9eDK81pwMm9gbnS8Cv84TuV-M,394
4
+ fmslist-0.0.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
5
+ fmslist-0.0.4.dist-info/licenses/LICENSE,sha256=ACwmltkrXIz5VsEQcrqljq-fat6ZXAMepjXGoe40KtE,1069
6
+ fmslist-0.0.4.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.2.dist-info/METADATA,sha256=5rvdDVw2USlkhi5jLVENdGCITrea1a72a2WPjksM2ig,413
4
- fmslist-0.0.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
5
- fmslist-0.0.2.dist-info/licenses/LICENSE,sha256=ACwmltkrXIz5VsEQcrqljq-fat6ZXAMepjXGoe40KtE,1069
6
- fmslist-0.0.2.dist-info/RECORD,,