Skip to content

Commit

Permalink
⭐(sina) filter space in response data
Browse files Browse the repository at this point in the history
  • Loading branch information
shidenggui committed Mar 12, 2020
1 parent e0ea2b5 commit 3aafbe2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions easyquotation/sina.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def stock_api(self) -> str:
def format_response_data(self, rep_data, prefix=False):
stocks_detail = "".join(rep_data)
stocks_detail = self.del_null_data_stock.sub('', stocks_detail)
stocks_detail = stocks_detail.replace(' ', '')
grep_str = self.grep_detail_with_prefix if prefix else self.grep_detail
result = grep_str.finditer(stocks_detail)
stock_dict = dict()
Expand Down
4 changes: 2 additions & 2 deletions tests/test_easyquotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ def test_stock_code_with_prefix(self):
cases = ["sina", "qq"]
for src in cases:
q = easyquotation.use(src)
data = q.all_market
data = q.market_snapshot(prefix=True)
for k in data.keys():
self.assertRegex(k, r"(sh|sz)\d{6}")

def test_all(self):
cases = ["sina", "qq"]
for src in cases:
q = easyquotation.use(src)
data = q.all
data = q.market_snapshot()
for k in data.keys():
self.assertRegex(k, r"\d{6}")

Expand Down

0 comments on commit 3aafbe2

Please sign in to comment.