TNO Intern

Commit 0f78eae1 authored by Arjo Segers's avatar Arjo Segers
Browse files

Removed timeout from download.

parent 66477802
Loading
Loading
Loading
Loading
+12 −9
Original line number Diff line number Diff line
@@ -9,6 +9,9 @@
#   Store access token in object to avoid server errors.
#   Retry if downloaded zipfile is corrupted.
#
# 2024-01, Arjo Segers
#   Do not use timeout when downloading.
#

########################################################################
###
@@ -19,9 +22,9 @@
"""
.. _cso-dataspace:

*************
CSO DataSpace
*************
************************
``cso_dataspace`` module
************************

The ``cso_dataspace`` module provides classes for accessing  data from the 
`Copernicus DataSpace <https://dataspace.copernicus.eu/>`_.
@@ -667,11 +670,14 @@ class CSO_DataSpace_Downloader(object):

    # *

    def DownloadFile(self, href, output_file, maxtry=10, timeout=60, indent=""):
    def DownloadFile(self, href, output_file, maxtry=10, nsec_wait=60, indent=""):

        """
        Download file from DataSpace.

        If a request fails it is tried again up to a maximum of ``maxtry`` times,
        with a delay of ``nsec_wait`` between requsts.

        Arguments:

        * ``href`` : download url, for example::
@@ -683,7 +689,7 @@ class CSO_DataSpace_Downloader(object):
        Optional arguments:
    
        * ``maxtry`` : number of times to try again if download fails
        * ``timeout`` : delay in seconds between requests
        * ``nsec_wait`` : delay in seconds between requests

        """

@@ -698,9 +704,6 @@ class CSO_DataSpace_Downloader(object):
        # tools:
        import cso_file

        # number of seconds to wait in retry loop:
        nsec_wait = 10

        # no token yet?
        if self.access_token is None:
            # info ..
@@ -720,7 +723,7 @@ class CSO_DataSpace_Downloader(object):
                # ensure that "~/.netrc" is ignored by passing null-authorization,
                # otherwise the token in the header is overwritten by a token formed
                # from the login/password in the rcfile if that is found:
                r = requests.get(href, auth=NullAuth(), headers=headers, timeout=timeout)
                r = requests.get(href, auth=NullAuth(), headers=headers)
                # check status, raise error if request failed:
                r.raise_for_status()