python生成url测试用例

it2022-05-05  205

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, '\n']) f.write(ts_url) posted on 2014-10-31 13:46 北京涛子 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/liujitao79/p/4064883.html


最新回复(0)