python字典与列表的使用--记录

上一篇 / 下一篇  2019-01-22 17:41:18 / 个人分类:python学习

import requests
import random
import time
import datetime
def send_post(url, data):
    res = requests.post(url=url, data=data)
    return res.text
tp = [
    {'userBindPhone': '18980001005', 'userId': '17081687'},
    {'userBindPhone': '13100020000', 'userId': '17087391'},
    {'userBindPhone': '13810086000', 'userId': '17084908'}
      ]
extend = {'ifBuyTttb': '0',
            'productcode': '0118003',
            'sign': '493SSB6FE7A669A43A97896AB90',
            'timestamp': '20190122105341',
            'uid': 'A30FC9C41C77777777E06F864A2937'
           }
url = 'http://xxx.xxx/useraction/getInDCCB'
for tpdata in tp:
    tpdata.update(extend)
    tpdata['money'] = (random.randint(1, 9)) * 100 # 生成1到9之间的随机数,再乘以100就是的购买金额
    print(send_post(url, tpdata), datetime.datetime.now())


TAG:

 

评分:0

我来说两句

我的栏目

日历

« 2024-03-28  
     12
3456789
10111213141516
17181920212223
24252627282930
31      

数据统计

  • 访问量: 3879
  • 日志数: 6
  • 图片数: 1
  • 建立时间: 2007-06-25
  • 更新时间: 2019-01-23

RSS订阅

Open Toolbar