Skip to content

Commit

Permalink
minor changes in __init__ of flipkart class
Browse files Browse the repository at this point in the history
  • Loading branch information
MrManiesh committed Dec 2, 2023
1 parent 3e3f1ab commit 6576791
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions flipkart.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
class flipkart:
def __init__(self, url):
self.url = url
request_status_code = requests.get(url, headers=header).status_code
if request_status_code != 200:
sys.exit(f"Unable to get the page. Error code: {request_status_code}")

html_text = requests.get(url, headers=header).text
response = requests.get(url, headers=header)

if response.status_code != 200:
sys.exit(f"Unable to get the page. Error code: {response.status_code}")

html_text = response.text
soup = BeautifulSoup(html_text, 'lxml')

product_html_element = soup.find('span', class_='B_NuCI')
Expand Down Expand Up @@ -50,8 +50,9 @@ def search_item(prod_name):
url = "https://www.flipkart.com/search?q=" + prod_name

request_status_code = requests.get(url, headers=header).status_code

if request_status_code != 200:
sys.exit(f"Unable to get the page. Error code: {request_status_code}")
sys.exit(f"- Unable to get the page. Error code: {request_status_code}")

html_text = requests.get(url, headers=header).text

Expand Down

0 comments on commit 6576791

Please sign in to comment.