123456789101112131415161718192021222324 |
- import random
- class Init_Captcha:
- def __init__(self):
- self.init_URL = "http://zxgk.court.gov.cn/xgl/captchaXgl.do"
- def get_captchaId(self):
- chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A',
- 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
- 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y',
- 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k',
- 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
- 'x', 'y', 'z']
- nums = ""
- for i in range(32):
- ids = int(random.random() * 61)
- nums += chars[ids]
- return nums
- #返回一个验证码的URL
- def main(self):
- captchaId = self.get_captchaId()
- MyRandom = str(random.random())
- return self.init_URL + "?captchaId=" + captchaId + "&random=" + MyRandom, captchaId, MyRandom
|