(d, reg, timeout)
| 65 | |
| 66 | # 通过正则寻找,找到返回[result],找不到返回[] |
| 67 | def find_timeout_re(d, reg, timeout): |
| 68 | for i in range(timeout): |
| 69 | t = d.dump_hierarchy() |
| 70 | t = json.dumps(t, ensure_ascii=False) |
| 71 | r = re.findall(reg, t) |
| 72 | if not r and i != timeout: |
| 73 | logger.debug('搜索 {} 次'.format(i + 1)) |
| 74 | time.sleep(0.8) |
| 75 | continue |
| 76 | return r |
| 77 | return [] |
| 78 | |
| 79 | |
| 80 | # 获取淘宝包名 |
no test coverage detected