python 谷歌用户名测试员

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 谷歌用户名测试员相关的知识,希望对你有一定的参考价值。

from time import sleep
import subprocess, json
import string

username_prefix = "prefix1234"


cmd = """curl 'https://accounts.google.com/InputValidator?resource=SignUp&service=mail' -H 'Referer: https://accounts.google.com/SignUp?service=mail&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&ltmpl=default' -H 'Origin: https://accounts.google.com' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36' -H 'Content-type: application/json' --data-binary '{"input01":{"Input":"GmailAddress","GmailAddress":"__name__","FirstName":"","LastName":""},"Locale":"en"}' --compressed"""

for i in range(10, 100):
        real_name = '%s%s' % (username_prefix, i)
        real_cmd = cmd.replace('__name__', real_name)
        p = subprocess.Popen(real_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        out = p.stdout.read()
        data = out.decode('utf-8')
        if "Try another" in data:
            print("%s: Taken" % real_name)
        else:
            with open("uname_%s.txt" % username_prefix, "a") as myfile:
                myfile.write("%s\n" % real_name)
            print("%s: OK <---" % real_name)

        sleep(2)

以上是关于python 谷歌用户名测试员的主要内容,如果未能解决你的问题,请参考以下文章

软件测试分类之测试员

超干货!软件测试常用术语(中英文对照),测试员必备!

40+岁老测试员生涯回顾,Python自动化从业十年是种什么体验?

40+岁老测试员生涯回顾,Python自动化从业十年是种什么体验?

40+岁老测试员生涯回顾,Python自动化从业十年是种什么体验?

40+岁老测试员生涯回顾,Python自动化从业十年是种什么体验?