Skip to content

Commit

Permalink
Merge pull request #37 from bkatiemills/helper_telemetry
Browse files Browse the repository at this point in the history
fallback for version fishing
  • Loading branch information
bkatiemills authored Jul 25, 2024
2 parents 2a2432d + ad97b4e commit 0ea2a6b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion argovisHelpers/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from shapely.ops import orient
import geopandas as gpd
import pkg_resources
from pkg_resources import DistributionNotFound

def slice_timesteps(options, r):
# given a qsr option dict and data route, return a list of reasonable time divisions
Expand Down Expand Up @@ -224,7 +225,11 @@ def argofetch(route, options={}, apikey='', apiroot='https://argovis-api.colorad
if option in options:
options[option] = str(options[option])

dl = requests.get(apiroot.rstrip('/') + '/' + route.lstrip('/'), params = options, headers={'x-argokey': apikey, 'x-avh-telemetry': pkg_resources.get_distribution('argovisHelpers').version})
try:
version = pkg_resources.get_distribution('argovisHelpers').version
except DistributionNotFound:
version = '-1'
dl = requests.get(apiroot.rstrip('/') + '/' + route.lstrip('/'), params = options, headers={'x-argokey': apikey, 'x-avh-telemetry': version})
statuscode = dl.status_code
if verbose:
print(urllib.parse.unquote(dl.url))
Expand Down

0 comments on commit 0ea2a6b

Please sign in to comment.