Added correct URL to uploader tool. Added notice if logs collected.
This commit is contained in:
+8
-2
@@ -10,7 +10,7 @@ import os
|
||||
import requests
|
||||
|
||||
# This is the URL to an installation of https://github.com/mbirth/tcl_update_db
|
||||
UPLOAD_URL = "http://example.org/tcl_update_db/"
|
||||
UPLOAD_URL = "https://tclota.birth-online.de/"
|
||||
LOGS_GLOB = os.path.normpath("logs/*.xml")
|
||||
|
||||
headers = { "Content-Type": "text/xml" }
|
||||
@@ -20,6 +20,12 @@ for fn in glob.glob(LOGS_GLOB):
|
||||
with open(fn, "rb") as f:
|
||||
r = requests.post(UPLOAD_URL, data=f, headers=headers)
|
||||
if r.status_code == 200:
|
||||
os.remove(fn)
|
||||
print(" OK")
|
||||
else:
|
||||
print(" ERROR: HTTP {}".format(r.status_code))
|
||||
add_text = ""
|
||||
if r.status_code in [413, 406, 412]:
|
||||
# File has been rejected by server, another try won't help
|
||||
os.remove(fn)
|
||||
add_text = " - Please try again later."
|
||||
print(" ERROR: HTTP {}{}".format(r.status_code, add_text))
|
||||
|
||||
Reference in New Issue
Block a user