def _get_captcha(self, _type="login", **kwargs): r = self._session.get(URL.captcha(_type=_type), **kwargs) with open('captcha.jpg', 'wb') as f: f.write(r.content) if platform.system() == 'Darwin': subprocess.call(['open', 'captcha.jpg']) elif platform.system() == 'Linux': subprocess.call(['xdg-open', 'captcha.jpg']) else: os.startfile('captcha.jpg') captcha = input("输入验证码:") return captcha
def _get_captcha(self, **kwargs): t = str(int(time.time() * 1000)) r = self._session.get(URL.captcha(t), **kwargs) with open('captcha.jpg', 'wb') as f: f.write(r.content) if platform.system() == 'Darwin': subprocess.call(['open', 'captcha.jpg']) elif platform.system() == 'Linux': subprocess.call(['xdg-open', 'captcha.jpg']) else: os.startfile('captcha.jpg') captcha = input("验证码:") return captcha