Skip to content

Commit

Permalink
fix attrs dependent on priceBand attr (dirty patch for #5)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdabhi23 committed Jul 16, 2019
1 parent 435e346 commit e1acddf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ bsedata is a library for collecting real-time data from Bombay Stock Exchange (I
The data is as accurate as provided on the [BSE website](m.bseindia.com).

> **Please do not use this application for production usage. It is best used for learning and building application for your own use. For commercial application you better buy a data service.**
>
>
> **This library uses MIT license hence liability lies with the user and not the author of the application.**
>
> **As per India's IT act it is no where mentioned that we cannot scrape a website. It's up to me whether I consume the publicly available data "visually" or through my programme or using some kind of "web reader". As long as data you are scrapping is available in public domain and you are not breaching security and accessing data of private nature with malicious intent, it cannot be termed as illegal.**
Expand Down
20 changes: 12 additions & 8 deletions bsedata/quote.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,18 @@ def quote(scripCode):
except KeyError:
continue

for tbody in soup('tbody'):
try:
if tbody['id'] == 'PBtablebody':
data = tbody.contents[2]
res['upperPriceBand'] = data.contents[1].string.strip()
res['lowerPriceBand'] = data.contents[2].string.strip()
except KeyError:
continue
if res['priceBand'] != '':
for tbody in soup('tbody'):
try:
if tbody['id'] == 'PBtablebody':
data = tbody.contents[2]
res['upperPriceBand'] = data.contents[1].string.strip()
res['lowerPriceBand'] = data.contents[2].string.strip()
except KeyError:
continue
else:
res['upperPriceBand'] = ''
res['lowerPriceBand'] = ''

buy = {}
sell = {}
Expand Down

0 comments on commit e1acddf

Please sign in to comment.