update synchronize/synchronize.py.
This commit is contained in:
parent
55bf25ae02
commit
9e5de62a45
@ -14,6 +14,10 @@ SystemName='GeMC API Synchronize Tool'
|
||||
SavePath='gemcapi/'
|
||||
Version='2.3.0'
|
||||
UserAgent={'User-Agent':'GeMCAPI/2.3.0 (GeMC Sync Release 2.3.0;Release)'}
|
||||
Proxies = {
|
||||
"http": "http://127.0.0.1:10809", #HTTP Proxies Setting
|
||||
#"https": "", #HTTPS Proxies Setting
|
||||
}
|
||||
Log='[' + time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) + ']' + '[INFO]:Starting the synchronizing system.\n' + '------------------------------------------------------------------------\n' + '[' + time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) + ']' + '[INFO]:Starting to specify global variables.\n' + '[' + time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) + ']' + '[INFO]:Specifying global variables successful.\n'
|
||||
print('[' + time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) + ']' + '[INFO]:Specifying global variables successful.')
|
||||
|
||||
@ -36,7 +40,8 @@ def synchronize(url, filepath):
|
||||
global UserAgent
|
||||
log('[INFO]:The ' + SystemName + ' is synchronizing the file ' + SavePath + filepath + '.')
|
||||
try:
|
||||
synchronize=requests.get(url, headers=UserAgent)
|
||||
#synchronize=requests.get(url, headers=UserAgent)#Without Proxies
|
||||
synchronize=requests.get(url, headers=UserAgent,proxies=Proxies)
|
||||
with open(SavePath + filepath,"wb") as code:
|
||||
code.write(synchronize.content)
|
||||
except:
|
||||
|
Reference in New Issue
Block a user