Commit 4f346369 authored by Franziska Koehn's avatar Franziska Koehn
Browse files

sends now file-size

parent b9c0a950
......@@ -160,9 +160,9 @@ def download_file_iter(url, creds):
response = requests.get(url, stream=True, auth=HTTPBasicAuth(user, passw))
if not response.ok:
raise ValueError(response.status_code)
return response.iter_content(1024)
return response.headers.get("content-length", None), response.iter_content(1024)
except IOError as e:
raise xsa.errors.WritingError("Error writing file %s, %s" % (path, e))
raise xsa.errors.WritingError("Error writing file %s" % e)
except ValueError as e:
raise xsa.errors.DownloadError("Error downloading file %s, Status Code %s" % (url, e))
......@@ -173,8 +173,9 @@ def prepare_rest(result, rest, host):
key ="{}")
return result[key]
ret = re.sub('\{\w+\}', subfunc, rest)
filename = ret.rpartition("/")[0].strip("/").replace("/","_")
return "%s%s" % (host, ret)
return "%s%s" % (host.strip('/'), ret), filename
def retry_qry(fun):
def retry(*args, **kwargs):
......@@ -217,7 +218,6 @@ def query_for_additional_data(rest, result, host, creds):
new_result[fieldname] = ''.join(value.text).replace("\n","")
return new_result
def search_for(host, root_element, constraints, search_fields, user, passw):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment