Skip to content

Commit

Permalink
#1 skip modified time check first
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuku Man committed Jul 17, 2018
1 parent fd42611 commit 3734234
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions jpl_ingest_single.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,18 @@
(stationID, lat, long, height) = entry

url = url_prefix + stationID + url_suffix
try:
last_mod = urllib2.urlopen(url).info().getdate('last-modified')
print(last_mod)
last_mod_ts = datetime(last_mod[:7])
today = datetime.today()
if (today - last_mod_ts) > timedelta(days=180):
print stationID + " inactive for over 180 days, skipping."
continue
except urllib2.URLError:
print stationID + " not available for download."
continue
# skip this part first
# try:
# last_mod = urllib2.urlopen(url).info().getdate('last-modified')
# print(last_mod)
# last_mod_ts = datetime(last_mod[:7])
# today = datetime.today()
# if (today - last_mod_ts) > timedelta(days=180):
# print stationID + " inactive for over 180 days, skipping."
# continue
# except urllib2.URLError:
# print stationID + " not available for download."
# continue
wgetcmd = "wget -nv -P " + workdir + " " + url
os.system(wgetcmd)

Expand Down

0 comments on commit 3734234

Please sign in to comment.