Skip to content

Commit

Permalink
cache agent error. Support mac
Browse files Browse the repository at this point in the history
  • Loading branch information
asadman1523 committed Mar 17, 2021
1 parent 063334b commit ce99e3d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
11 changes: 7 additions & 4 deletions RenameTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,13 @@ def run(self):

def getResponse(self, url, stream=False):
req = requests.session()
req.mount('http://', HTTPAdapter(max_retries=5))
req.mount('https://', HTTPAdapter(max_retries=5))
ua = UserAgent()
headers = {'User-Agent': ua.random}
headers = {}
try:
ua = UserAgent()
headers = {'User-Agent': ua.random}
except:
print('FakeUserAgentError. It often happened...Just ignore it.\n')
pass
response = req.get(url, headers=headers, stream=stream, timeout=5)
response.encoding = 'utf-8'
return response
1 change: 1 addition & 0 deletions mac_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python3 odvrt.py
1 change: 1 addition & 0 deletions odvrt.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
import pathlib
import re
import sys
Expand Down
File renamed without changes.

0 comments on commit ce99e3d

Please sign in to comment.