Created
October 12, 2011 03:02
-
-
Save xkyii/1280148 to your computer and use it in GitHub Desktop.
pyUtil
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import urllib2 | |
import urllib | |
import cookielib | |
minus_invite = "http://min.us/rjRVW6n" #邀请地址 | |
commit_url = "http://minus.com/api/login/register" #注册地址 | |
def open_url(): | |
"""打开邀请地址""" | |
print('connectting...') | |
open_response = opener.open(minus_invite) | |
print('respose.code=' + str(open_response.code)) | |
def commit_form(user,pw): | |
"""提交注册信息""" | |
print('commit form...') | |
print('username=' + user + ',password=' + pw) | |
search = urllib.urlencode([('username',user),('password1',pw),('password2',pw),('email',''),('regname','')]) | |
req = urllib2.Request(commit_url) | |
fd = urllib2.urlopen(req,search) | |
print('fd.code=' + str(fd.code)) | |
print('read()=' + fd.read()) | |
cookie = cookielib.CookieJar() | |
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookie)) | |
urllib2.install_opener(opener) | |
for i in range(17,51): | |
open_url() | |
commit_form('vk_test'+str(i),'test111') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment