defparse_out(domain: list): path = "./result" ifnot os.path.exists(path): os.makedirs(path) for key in domain: res_dict = xml_to_json(getxml(key)) if res_dict["returncode"] == "200": statu = "请求成功" else: statu = "请求失败" if res_dict["original"][:3] == "210": original = "-------域名可以注册--------"
withopen("./result/result_true.txt", "a", encoding="utf8") as result_true: result_true.write(key + "\n")
elif res_dict["original"][:3] == "211": original = "域名已经被注册" elif res_dict["original"][:3] == "212": original = "域名参数传输错误" else: original = "查询超时" out_str = "域名:{0}\t请求状态:{1}\t注册状态:{2}".format(key, statu, original) withopen("./result/result.txt", "a", encoding="utf8") as result: result.write(out_str + "\n") time.sleep(2) print(out_str) raw_input("查询完毕!请在result文件夹下的result_true.txt中查看可购买的域名!感谢您的使用,请按任意键退出此窗口!")
input_list = [] for n inrange(count): for f inrange(bits): i = random.randint(0, len(domain_list) - 1) input_str += domain_list[i] iflen(ext) == 0: ext = [".com"] for e in ext: input_list.append(input_str + e) input_str = "" return input_list