nsidc / NSIDC-Data-Access-Notebook

A Jupyter notebook exploring data coverage, size, and customization service availability along with direct data download utilizing the NSIDC DAAC's access and service API.
57 stars 33 forks source link

Connection Issues #4

Open cmarshak opened 4 years ago

cmarshak commented 4 years ago

For the notebook provided, I am currently getting the following error quite frequently and cannot easily make get requests:

ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

I get this when running the cell:

# Query service capability URL 

from xml.etree import ElementTree as ET

capability_url = f'https://n5eil02u.ecs.nsidc.org/egi/capabilities/{short_name}.{latest_version}.xml'

print(capability_url)
# Create session to store cookie and pass credentials to capabilities url

session = requests.session()
s = session.get(capability_url)
response = session.get(s.url,auth=(uid,pswd))

root = ET.fromstring(response.content)

Is this a maintenance issues? Or working remotely away from a NASA facility?

Hope you are all taking good care during these trying and scary times.

betolink commented 4 years ago

@cmarshak I tried to reproduce the error but I couldn't. If you ran the requests on a Wednesday chances are that it was a maintenance issue. NSIDC does that every Wednesday morning and some services get degraded. The URL should be accessible from anywhere as long as you enter valid EarthData login credentials.

cmarshak commented 4 years ago

When I run the code through my JPL VPN, I do not have the issue. It's when I run the code through my home network.

Because I am downloading a lot of data, I am trying to avoid routing any requests through a VPN.

Thank you again for your help.

ghost commented 4 years ago

@cmarshak: I'm Lisa with NSIDC User Services. I'm working with our Data Operations and System Administrators to troubleshoot your issue. I'll let you know when I have more information.

cmarshak commented 4 years ago

Thank you! I am currently able to use a JPL server so I am not dealing with these problems.

As an aside, I have found that the session from the notebook are no longer working.

I had to replace session objects with those I found from here.

Specifically:

class SessionWithHeaderRedirection(requests.Session):
    AUTH_HOST = 'urs.earthdata.nasa.gov'
    def __init__(self, username, password):

        super().__init__()

        self.auth = (username, password)

    def rebuild_auth(self, prepared_request, response):
        headers = prepared_request.headers
        url = prepared_request.url
        if 'Authorization' in headers:
            original_parsed = requests.utils.urlparse(response.request.url)
            redirect_parsed = requests.utils.urlparse(url)
            if (original_parsed.hostname != redirect_parsed.hostname) and \
                    redirect_parsed.hostname != self.AUTH_HOST and \
                    original_parsed.hostname != self.AUTH_HOST:
                 del headers['Authorization']

        return
ghost commented 4 years ago

@cmarshak I apologize for the delay in getting back to you. We appreciate that you brought the Earthdata code snippet to our attention and we’re looking into incorporating it.

To help us troubleshoot further, could you do the following:

  1. Provide us with your code so we can see how you're doing the multi threading?
  2. Could you attempt another download and give us the time you did that so we can look through the logs?
asteiker commented 9 months ago

CRYO-29