fake-useragent 替代库 anole

fake-useragent替代库anole

安装使用:pip install anole

下面为官网译文:

Project description
项目描述

Like a anole, fake everything.
像小丑一样,假装一切。

Currently support user agent and name fake, other will be coming soon.
目前支持用户代理和假名,其他将很快到来。

Thanks for use.
谢谢你的使用

How to use
如何使用

from anole import UserAgent


# Suppose this is the request headers
headers = {
    "referer": "https://leesoar.com"
}
user_agent = UserAgent()
user_agent.fake(headers)

It will check if there is “user-agent” in headers. If not, “user-agent” will update with random.
它将检查标题中是否有“user-agent”。如果没有,“user-agent”将随机更新。

from anole import Name


name = Name()
name.fake()   # Whole name's length is between 2 and 3.
name.fake(length=2)   # You can specify the length of the name.
name.fake(surname="李")   # And you can specify the surname.

假名

Use as fake_useragent
作为fake_useragent使用

from anole import UserAgent


user_agent = UserAgent()
user_agent.random
# or user_agent.chrome
# or other browsers
  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值