-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathamazon_review.py
38 lines (37 loc) · 1.15 KB
/
amazon_review.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
class AmazonReview:
def __init__(self):
self.id = ""
self.rating = 0
self.title = ""
self.href = ""
self.country = ""
self.date = None
self.body = ""
self.verified_purchase = False
self.found_helpful = 0
# self.product_url = ""
self.username = ""
self.username_url = ""
self.images = []
self.videos = []
self.found_under = []
def to_dict(self):
return {
"id": self.id,
"rating": self.rating,
"title": self.title,
"href": self.href,
"country": self.country,
"date": (
str(self.date) if self.date else None
), # Ensure date is serialized as string
"body": self.body,
"verified_purchase": self.verified_purchase,
"found_helpful": self.found_helpful,
# "product_url": self.product_url,
"username": self.username,
"username_url": self.username_url,
"images": self.images,
"videos": self.videos,
"found_under": self.found_under,
}