示例#1
0
    def __call__(self):
        try:
#            print("Running %d ..." % self.code, file=sys.stderr)
            (timestamp, px_open, px_high, px_low, px_last, px_volume) = realtime.get_realtime_data(code=self.code, index=self.index, proxy=self.proxy)
            return (self.code, timestamp, px_open, px_high, px_low, px_last, px_volume)
        except Exception as e:
#            traceback.print_exc(file=sys.stderr)
            return (self.code, None, None, None, None, None, None)  # MUST preserve the code even if errors occurred
示例#2
0
文件: proxy.py 项目: nghei/on-lun-9
def check_proxy(proxy, tries=16, timeout=5):
    for i in range(0, tries):
        res = realtime.get_realtime_data(1, index=i, proxy=proxy, timeout=timeout)
        if not res:
            return None
    return proxy