Due to the lapse in federal government funding, NASA is not updating this website. We sincerely regret this inconvenience.
NASA Logo
Ocean Color Science Software

ocssw V2022
seadasutils.JsonUtils Namespace Reference

Classes

class  SessionUtils
 

Functions

def base_url (url)
 
def full_url (url, link)
 
def is_page (url)
 
def retry (func, *args, **kwargs)
 
def set_mtime (filepath, mtime)
 
def linkdict (rows)
 
def link_mtime (mtime)
 
def getlinks_json (content)
 
def needs_download (link, filepath, check_times=False)
 
def is_json (response)
 
def ok_status (response)
 

Variables

 url = sys.argv[1]
 
 sessionUtil = SessionUtils()
 
 links = sessionUtil.get_links(url)
 

Function Documentation

◆ base_url()

def seadasutils.JsonUtils.base_url (   url)

Definition at line 12 of file JsonUtils.py.

◆ full_url()

def seadasutils.JsonUtils.full_url (   url,
  link 
)
Add query to urljoin() results
ONLY if it's a page

Definition at line 17 of file JsonUtils.py.

◆ getlinks_json()

def seadasutils.JsonUtils.getlinks_json (   content)

Definition at line 96 of file JsonUtils.py.

◆ is_json()

def seadasutils.JsonUtils.is_json (   response)

Definition at line 126 of file JsonUtils.py.

◆ is_page()

def seadasutils.JsonUtils.is_page (   url)
Make the dangerous assumption that URLs
pointing to another web page always end in '/'.

Definition at line 31 of file JsonUtils.py.

◆ link_mtime()

def seadasutils.JsonUtils.link_mtime (   mtime)
Format remote file timestamp as seconds since the epoch.

Definition at line 85 of file JsonUtils.py.

◆ linkdict()

def seadasutils.JsonUtils.linkdict (   rows)
Each link in list is a dictionary describing a remote file:
link['href']  = URL pointing to file
link['mtime'] = timestamp as seconds since the epoch
link['size']  = size in bytes

Definition at line 69 of file JsonUtils.py.

◆ needs_download()

def seadasutils.JsonUtils.needs_download (   link,
  filepath,
  check_times = False 
)
Returns False if filepath is present and size matches remote url;
True otherwise.  Optionally check timestamp as well.

Definition at line 100 of file JsonUtils.py.

◆ ok_status()

def seadasutils.JsonUtils.ok_status (   response)

Definition at line 130 of file JsonUtils.py.

◆ retry()

def seadasutils.JsonUtils.retry (   func,
args,
**  kwargs 
)
Retry specified function call after a short delay

Definition at line 41 of file JsonUtils.py.

◆ set_mtime()

def seadasutils.JsonUtils.set_mtime (   filepath,
  mtime 
)
Set modification time for specified file.
Set access time to "now".

Definition at line 55 of file JsonUtils.py.

Variable Documentation

◆ links

links = sessionUtil.get_links(url)

Definition at line 224 of file JsonUtils.py.

◆ sessionUtil

sessionUtil = SessionUtils()

Definition at line 223 of file JsonUtils.py.

◆ url

string url = sys.argv[1]

Definition at line 219 of file JsonUtils.py.