Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fallback for version fishing #37

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading