码迷,mamicode.com
首页 > 编程语言 > 详细

python 实现cm批量上传

时间:2017-08-18 19:59:01      阅读:260      评论:0      收藏:0      [点我收藏+]

标签:random   dmi   .post   dom   wow   for   port   exce   type   

import requests
import json
import time
import random

url = http://cm.admin.xxxx.com/customer/aj_addcontent.php

headers = {User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0,
Referer:http://cm.admin.weibo.com/customer/customerInfo.php?type=1&uid=5195970647,
Cookie:PHPSESSID=6a63d980ta1i11mg5sr6dbo4k6; BD-ADMIN-G0-TC=c566a5c61739c08a83ae255975d4545e; _SECRET=d8e6970e2c26193f8ffeffe38e2d84e3; _INFO=2903gVsIwYR8sHdGS%2BaHsAkusffES%2FUFEv6GQcxMYp%2FlduFyNy2CxTA2GAHpSw0Vn6Aw0ZH0yt2r78gWcgUfHY1eMr2t6LCFzwDg5x7zwL3yI97qVY84nJK7u6Q}

content = [‘1’,2,3]


with open(uids.txt,r) as f:
    for i in f:
        data = {
            nickname:‘‘,
            uid:i.strip(),
            company:‘‘,
            contents:‘‘,
            content:random.choice(content),
        }
        try:
            res = requests.post(url,data,headers=headers)
            a = json.loads(res.text)[msg]
            time.sleep(random.randint(2,6))
            print(a)
            if 添加成功 in a:
                print(a)
            else:
                print(a + i)
        except Exception as e:
            print(e,i)

 

python 实现cm批量上传

标签:random   dmi   .post   dom   wow   for   port   exce   type   

原文地址:http://www.cnblogs.com/Erick-L/p/7391048.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!