# -*- coding: cp936 -*-
import urllib
import urllib2
import time
url = "http://xxx.xxx.xxx.xxx/cgi-bin/addaward"
UUID = 'xxxxxx'
with open('xxx.txt','r') as f:
lines = f.readlines()
for line in lines:
if line=='\n': break
temp = line.strip('\n').split('\t')
uType = temp[0]
uSubType = temp[1]
uid = temp[2]
value = {
'AreaID':'1',
'Uid':UUID,
'Name':'',
'Type':uType,
'SubType':uSubType,
'ID':uid,
'Count':'1',
'Lock':'0'
}
data = urllib.urlencode(value)
req = urllib2.Request(url,data)
response = urllib2.urlopen(req)
time.sleep(1)
ok=input('结束')
读取文件格式为:
6 2
7102xxx
6 2 7028xxx