Getting the urls of a download#

This example prints the download URLs for files returned from an ‘as-is’ data export request.

Note that there is no “Request URL” for method ‘url_quick’.

import os

import drms

First we will create a drms.Client, using the JSOC baseurl.

client = drms.Client()

# This example requires a registered export email address. You can register
# JSOC exports at:
# You must supply your own email.
email = os.environ["JSOC_EMAIL"]
Traceback (most recent call last):
  File "/home/docs/checkouts/", line 23, in <module>
    email = os.environ["JSOC_EMAIL"]
  File "<frozen os>", line 679, in __getitem__
KeyError: 'JSOC_EMAIL'

Construct the DRMS query string: “Series[timespan][wavelength]”

qstr = "hmi.ic_720s[2015.01.01_00:00:00_TAI/10d@1d]{continuum}"

# Submit export request, defaults to method='url_quick' and protocol='as-is'
print(f"Data export query:\n  {qstr}\n")
print("Submitting export request...")
result = client.export(qstr, email=email)
print(f"{len(result.urls)} file(s) available for download.\n")

# Print download URLs.
for _, row in result.urls[["record", "url"]].iterrows():
    print(f"REC(ORD): {row.record}")
    print(f"URL: {row.url}\n")

Total running time of the script: (0 minutes 0.002 seconds)

Gallery generated by Sphinx-Gallery