Skip to content

Commit

Permalink
Adding discount price
Browse files Browse the repository at this point in the history
  • Loading branch information
Mirio committed Nov 13, 2017
1 parent 33a83f5 commit 0372ed6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
name='steamstoreprice',
packages=['steamstoreprice'],
package_dir={'steamstoreprice': 'steamstoreprice'},
version='0.1',
version='0.2',
install_requires=['requests', 'beautifulsoup4'],
description='Find the price on Steam Store from url',
author='Alessandro Sbarbati',
Expand Down
5 changes: 4 additions & 1 deletion steamstoreprice/steamstoreprice.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,7 @@ def getprice(self, url):
:return: float(price cleaned)
"""
body_content = self.getpage(self.normalizeurl(url))
return self.normalizeprice(body_content.find("div", {"class": "game_purchase_price"}).contents[0])
try:
return self.normalizeprice(body_content.find("div", {"class": "game_purchase_price"}).contents[0])
except AttributeError:
return self.normalizeprice(body_content.find("div", {"class": "discount_final_price"}).contents[0])

0 comments on commit 0372ed6

Please sign in to comment.