Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 50bec1a

Browse files
Merge pull request avinashkranjan#2729 from avinashkranjan/deepsource-transform-41756810
format code with autopep8
2 parents a88ca4b + 77b4199 commit 50bec1a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

‎Amazon_product_scraper/products.py‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import requests
22
from bs4 import BeautifulSoup
33

4+
45
class Product:
56
def __init__(self, product_name: str):
67
self.product_name = product_name
@@ -56,8 +57,10 @@ def get_product_details(self):
5657
}
5758
r = requests.get(product_link, headers=headers)
5859
soup = BeautifulSoup(r.content, "html.parser")
59-
product_name = soup.find("span", {"id": "productTitle"}).text.strip()
60-
product_price = soup.find("span", {"class": "a-price-whole"}).text.strip()
60+
product_name = soup.find(
61+
"span", {"id": "productTitle"}).text.strip()
62+
product_price = soup.find(
63+
"span", {"class": "a-price-whole"}).text.strip()
6164
product_rating = soup.find(
6265
"span", {"class": "a-size-base a-color-base"}
6366
).text.strip()
@@ -164,7 +167,8 @@ def customer_review(self):
164167
review_text = review_element.find(
165168
"span", {"data-hook": "review-body"}
166169
).text.strip()
167-
review = [reviewer_name, rating, review_title, review_date, review_text]
170+
review = [reviewer_name, rating,
171+
review_title, review_date, review_text]
168172
return {
169173
"data": review,
170174
"message": f"Product review has been fetched",

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /