码迷,mamicode.com
首页 > 其他好文 > 详细

一个pycurl传header的例子

时间:2014-09-29 18:00:21      阅读:576      评论:0      收藏:0      [点我收藏+]

标签:pycurl header

#!/usr/bin/python

import pycurl

import socket

import time


def work_socket():

    s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)

    s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

    s.bind((‘10.67.15.96‘,9999))

    s.listen(10)

    s.setblocking(0)

    s.settimeout(10)

    conn,addr=s.accept()

    conn.send(‘10.67.15.96‘)




if __name__ == ‘__main__‘:

        common_list=[‘10.67.15.22‘,‘10.67.15.24‘,‘10.67.15.25‘,‘10.67.15.48‘]

        bigapp_list=[‘10.67.15.39‘,‘10.67.15.65‘,‘10.67.15.66‘,‘10.67.15.27‘]

        ent_list=[‘10.67.15.23‘,‘10.67.15.42‘,‘10.67.15.43‘,‘10.67.15.67‘,‘10.67.15.68‘,‘10.67.15.69‘]

        c=pycurl.Curl()

        for ia in range(100):

            for i in common_list:

                c.setopt(c.HTTPHEADER,["Host:monitorcommon1.sinaapp.com","Appname:monitorcommon1","AppVersion:3","AppHash:604","AccessKey:2ynwm3xxlm","SecretKey: lwz24

z32mm3lz0ji225x4ykwhk1x5mwkj33x1wwy","McIP: 1default;1::;1:@default:;;","MysqlPort: 3307","AppCookie: aks=4j33x1wm2n,5020k300z0,5m0lw4l3zl,o4550jjym3,o1n5kwmyx0,3ozlxl

o0jy,k40z12j23x,yyl3jxzj3x,kxjyl3llyy,,,,looz04o3my,,0oz4y4wx4k,z2wlx21240,o4lj5jl5nl,noyj200ml0;debug=1"])

                c.setopt(c.URL,‘%s/monitor.html‘%i)

                c.perform()

            for ii in bigapp_list:

                c.setopt(c.HTTPHEADER,["Host: monitorbigapp1.sinaapp.com","Appname: monitorbigapp1","AppVersion:3", "AppHash: 953", "AccessKey: 0y34wm3zlz", "SecretKey

: 0z3mh2jwmz45mjkzkii3iw5zwyylk5mw0x500xzl", "McIP: 1default;1::;1:@default:;;", "MysqlPort: 3307", "AppCookie: aks=4j33x1wm2n,5020k300z0,5m0lw4l3zl,o4550jjym3,o1n5kwm

yx0,3ozlxlo0jy,k40z12j23x,yyl3jxzj3x,kxjyl3llyy,,,,looz04o3my,,0oz4y4wx4k,z2wlx21240,o4lj5jl5nl,noyj200ml0;debug=1"])

                c.setopt(c.URL,‘%s/monitor.html‘%ii)

                c.perform()

            for iii in ent_list:

                c.setopt(c.HTTPHEADER,["Host: monitorent1.sinaapp.com", "Appname: monitorent1", "AppVersion: 3", "AppHash: 156", "AccessKey: 3lyw2wky00", "SecretKey: l

1llk425x3zi0lyzllil00lh1j23z54wz11z4yiw", "McIP: 1default;1::;1:@default:;;", "MysqlPort: 3307", "AppCookie: aks=4j33x1wm2n,5020k300z0,5m0lw4l3zl,o4550jjym3,o1n5kwmyx0

,3ozlxlo0jy,k40z12j23x,yyl3jxzj3x,kxjyl3llyy,,,,looz04o3my,,0oz4y4wx4k,z2wlx21240,o4lj5jl5nl,noyj200ml0;debug=1"])

                c.setopt(c.URL,‘%s/monitor.html‘%iii)

                c.perform()

            time.sleep(5)


本文出自 “expect批量同步数据” 博客,请务必保留此出处http://4249964.blog.51cto.com/4239964/1559298

一个pycurl传header的例子

标签:pycurl header

原文地址:http://4249964.blog.51cto.com/4239964/1559298

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