# IP代理池
def get_proxy():
    \'\'\'
    简答模拟代理池
    返回一个字典类型的键值对,
    \'\'\'
    proxy = ["http://116.211.143.11:80",
             "http://183.1.86.235:8118",
             "http://183.32.88.244:808",
             "http://121.40.42.35:9999",
             "http://222.94.148.210:808"]
    fakepxs = {}
    fakepxs[\'http\'] = proxy[random.randint(0, len(proxy))]
    
    return fakepxs

#使用fake-useragent 模块

# 使用fake-useragent 模块
from fake_useragent import UserAgent
ua = UserAgent()  # 创建 UserAgent的对象
ua.random  # 通过获得随机的 ua

 

版权声明:本文为pupilheart原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/pupilheart/articles/10096840.html