Skip to content

Commit

Permalink
re-fix socket error (#163)
Browse files Browse the repository at this point in the history
See #98, which was partly undone by #96.
  • Loading branch information
JessicaS11 committed Jan 20, 2021
1 parent 0283100 commit 96a2fac
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions icepyx/core/Earthdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,13 @@ def __init__(
def _start_session(self):
# Request CMR token using Earthdata credentials
token_api_url = "https://cmr.earthdata.nasa.gov/legacy-services/rest/tokens"
hostname = socket.gethostname()
ip = socket.gethostbyname(hostname)
# try initially with machine hostname
# revert to using localhost if gaierror exception
try:
ip = socket.gethostbyname(socket.gethostname())
except:
ip = socket.gethostbyname("localhost")


data = {
"token": {
"username": self.uid,
Expand Down

0 comments on commit 96a2fac

Please sign in to comment.