8000 Replace user agent module · yezzatech/wc-api-python@1d0f427 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1d0f427

Browse files
committed
Replace user agent module
1 parent 731955a commit 1d0f427

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
requests==2.22.0
22
ordereddict==1.1
3-
fake-useragent==0.1.11
3+
random-user-agent==1.0.1

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
install_requires=[
3838
"requests>=2.22.0",
3939
"ordereddict>=1.1",
40-
"fake-useragent>=0.1.11"
40+
"random-user-agent>=1.0.1"
4141
],
4242
classifiers=[
4343
"Development Status :: 5 - Production/Stable",

woocommerce/api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
from requests import request
1313
from json import dumps as jsonencode
1414
from time import time
15-
from fake_useragent import FakeUserAgent
15+
from random_user_agent.user_agent import UserAgent
1616
from woocommerce.oauth import OAuth
1717

1818
try:
1919
from urllib.parse import urlencode
2020
except ImportError:
2121
from urllib import urlencode
2222

23-
ua = FakeUserAgent()
23+
ua = UserAgent()
2424

2525
class API(object):
2626
""" API Class """
@@ -73,7 +73,7 @@ def __request(self, method, endpoint, data, params=None, **kwargs):
7373
url = self.__get_url(endpoint)
7474
auth = None
7575
headers = {
76-
"user-agent": ua.random,
76+
"user-agent": ua.get_random_user_agent(),
7777
"accept": "application/json"
7878
}
7979

0 commit comments

Comments
 (0)
0