diff --git a/feapder/network/request.py b/feapder/network/request.py index a1b6e322..d805aaec 100644 --- a/feapder/network/request.py +++ b/feapder/network/request.py @@ -256,7 +256,7 @@ def get_response(self, save_cached=False): self.requests_kwargs.setdefault( "headers", { - "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36" + "User-Agent": setting.DEFAULT_USERAGENT }, ) diff --git a/feapder/setting.py b/feapder/setting.py index 9891aa14..a007cead 100644 --- a/feapder/setting.py +++ b/feapder/setting.py @@ -89,6 +89,8 @@ # 随机headers RANDOM_HEADERS = True +# 默认使用的浏览器头 RANDOM_HEADERS=True时不生效 +DEFAULT_USERAGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36" # requests 使用session USE_SESSION = False