Skip to content

Commit

Permalink
Add fake user agent and update MarkupSafe (#14)
Browse files Browse the repository at this point in the history
* Update MarkupSafe to 1.1.1

* Add fake user agent to the default settings

* Add fake user agent to the default settings
  • Loading branch information
hankshz authored Apr 23, 2020
1 parent 0a47602 commit 6505f91
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ colorama==0.3.9
cssselect==1.0.1
docopt==0.6.2
et-xmlfile==1.0.1
fake_useragent==0.1.11
Flask==0.12.2
gevent==1.2.2
greenlet==0.4.12
Expand All @@ -15,7 +16,7 @@ itsdangerous==0.24
jdcal==1.3
Jinja2==2.10
lxml==4.1.1
MarkupSafe==1.0
MarkupSafe==1.1.1
odfpy==1.3.6
openpyxl==2.4.9
pycrypto==2.6.1
Expand Down
5 changes: 3 additions & 2 deletions settings.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os

from fake_useragent import UserAgent
from toapi.cache import MemoryCache, RedisCache, JsonSerializer
from toapi.settings import Settings

Expand All @@ -18,7 +19,7 @@ class MemCacheSettings(Settings):
}
web = {
"with_ajax": False,
"request_config": {},
"request_config": {"headers": {'User-Agent': UserAgent().random}},
"headers": None
}

Expand All @@ -41,6 +42,6 @@ class RedisCacheSettings(Settings):
}
web = {
"with_ajax": False,
"request_config": {},
"request_config": {"headers": {'User-Agent': UserAgent().random}},
"headers": None
}

0 comments on commit 6505f91

Please sign in to comment.