Python参数拼接

# -*- coding:utf-8 -*-

import time
import get

url = "http://.........."
# url_test = "http://.................."


def send_request(url, deviceType, action):
    try:
        response = get.post(
            url=url + "/push...." + deviceType + "/" + action + "/0/150650/0/0",
        )
        print('Response HTTP Status Code: {status_code}'.format(
            status_code=response.status_code))
        print('Response HTTP Response Body: {content}'.format(
            content=response.content))
    except Exception,e:
        print('HTTP Request failed',e)


if __name__ == '__main__':
    action_10_array = ['18','19','20','100','101','5','6','14','24','25','32','34','2','3']
    action_1_array = ['10','12','2','1']
    action_11_array = ['10']
    action_2_array = ['2', '1', '10', '6','5']
    action_7_array = ['5', '6', '14', '10','7','1']
    action_doorbell_array = ['handmove', 'doorbell', 'lowPower', 'offline','dismantle']
    action_SmokeAlarm_array = ['1','3']
    # action_10_array = ['100','101','2','3']

    for i in range(0,len(action_doorbell_array)):
        action = action_doorbell_array[i]
        deviceType = 'doorbell'
        #以上参数要改
        print action

        send_request(url, deviceType, action)
        time.sleep(1)

        # send_request(url_test, deviceType, action)

        xx = raw_input()  #按下输出

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值