新增模块httpget

This commit is contained in:
Bigsk 2020-07-26 19:25:12 +08:00 committed by Gitee
parent 558a662b21
commit 76c54149d2

View File

@ -71,6 +71,12 @@ def sychronize(url, filepath):
log('[ERROR]:There has a error in task of synchronizing the file ' + SavePath + filepath + '.') log('[ERROR]:There has a error in task of synchronizing the file ' + SavePath + filepath + '.')
else: else:
log('[INFO]:The file ' + SavePath + filepath + ' has been synchronized successfully.') log('[INFO]:The file ' + SavePath + filepath + ' has been synchronized successfully.')
#Function Which Be Used To Get HTTP Site With Requests Avoid Error.
def httpget(url):
try:
return requests.get(url=url, headers=UserAgent).text
except:
return 'error'
log('[INFO]:Loading all kinds of functions successfully.') log('[INFO]:Loading all kinds of functions successfully.')
#------------------------------------------------------------------------# #------------------------------------------------------------------------#