Skip to content

Commit 0ae7a7c

Browse files
committed
Convert user_agents.json to Python
1 parent 23364cc commit 0ae7a7c

File tree

3 files changed

+4
-40
lines changed

3 files changed

+4
-40
lines changed

MANIFEST.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include LICENSE README.md cfscrape/user_agents.json
1+
include LICENSE README.md

cfscrape/__init__.py

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# -*- coding: utf-8 -*-
22

3-
import json
43
import logging
54
import random
65
import re
@@ -19,14 +18,11 @@
1918

2019
from urllib3.util.ssl_ import create_urllib3_context, DEFAULT_CIPHERS
2120

22-
__version__ = "2.0.5"
21+
from .user_agents import USER_AGENTS
2322

24-
USER_AGENTS_PATH = os.path.join(os.path.dirname(__file__), "user_agents.json")
23+
__version__ = "2.0.6"
2524

26-
with open(USER_AGENTS_PATH) as f:
27-
user_agents = json.load(f)
28-
29-
DEFAULT_USER_AGENT = random.choice(user_agents)
25+
DEFAULT_USER_AGENT = random.choice(USER_AGENTS)
3026

3127
DEFAULT_HEADERS = OrderedDict(
3228
(

cfscrape/user_agents.json

-32
This file was deleted.

0 commit comments

Comments
 (0)