zoukankan      html  css  js  c++  java
  • python生成url测试用例

    generate_url.py

    #!/usr/bin/env python
    
    import random
    import os, sys
    
    channels = [ 
        "BTV2", "BTV3", "BTV4", "BTV5", "BTV6", "BTV7", "BTV8", "BTV9", 
        "BTVWorld", "CCTV12", "CCTV2", "CCTV3", "CCTV5", "CCTV6", "CCTV6World", "CCTV7", 
        "CCTV8", "CCTV9World", "CCTVA", "CCTVChild", "CCTVE", "CCTVEN", "CCTVF", "CCTVFYYY", 
        "CCTVHJJC", "CCTVMusic", "CCTVNEWS", "CCTVR", "CETV1", "CETV3", "ChongQingTV", "ChongQingWorld", 
        "GZChild", "GZEnglish", "GZFinance", "GZJingSai", "GZMovie", "GanSuTV", "GuangXiTV", "GuiZhouTV", 
        ]
    
    host = '10.160.1.21'
    date = '2014/10/31'
    bitrates = ['800000']
    ts_path = '/opt/online01/stream'
    
    with open('/opt/urllist', 'wt') as f:
        for i in xrange(1, 2**16):
            channel = random.choice(channels)
            bitrate = random.choice(bitrates)
            path = ''.join([ts_path, '/', bitrate, '/', channel, '/', date])
            filenames = os.listdir(path)
            filename = random.choice(filenames)
            ts_url = ''.join(['http://', host, '/', 'online01/stream/', bitrate, '/', channel, '/', date, '/', filename, '
    '])
            f.write(ts_url) 
    
    
    
    
  • 相关阅读:
    css深入理解absolute
    CSS深入理解float
    SpringBoot连接Oracle
    Oralce分页
    ps
    VUE基本安装
    JAVA运行war包
    MYSQL数据库事务隔离级别
    如何设计一个关系型数据库
    省选模拟22
  • 原文地址:https://www.cnblogs.com/liujitao79/p/4064883.html
Copyright © 2011-2022 走看看