Skip to content

Commit

Permalink
Merge pull request shidenggui#65 from muxuezi/patch-5
Browse files Browse the repository at this point in the history
_random class property is surplus
  • Loading branch information
shidenggui authored Jul 6, 2019
2 parents 96b30bf + d7dc10c commit eaa2b98
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions easyquotation/sina.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding:utf8
import random
import re

import time
from . import basequotation


Expand All @@ -20,13 +20,8 @@ class Sina(basequotation.BaseQuotation):

@property
def stock_api(self) -> str:
return f"http://hq.sinajs.cn/rn={self._random()}&list="
return f"http://hq.sinajs.cn/rn={int(time.time()*1000)}&list="

@staticmethod
def _random(length=13) -> str:
start = 10 ** (length - 1)
end = (10 ** length) - 1
return str(random.randint(start, end))

def format_response_data(self, rep_data, prefix=False):
stocks_detail = "".join(rep_data)
Expand Down

0 comments on commit eaa2b98

Please sign in to comment.