Skip to content

Commit

Permalink
First working release
Browse files Browse the repository at this point in the history
  • Loading branch information
b8raoult committed Dec 1, 2021
1 parent 300faa2 commit 010d4f0
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
with:
python-version: '3.x'

- name: Check that tag version matches climetlab version
- name: Check that tag version matches code version
run: |
tag=${GITHUB_REF#refs/tags/}
version=$(python setup.py --version)
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,4 @@ data
*.grib
*.grib2
?
*.download
2 changes: 1 addition & 1 deletion ecmwf/opendata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@

__version__ = "0.0.1"

__all__ = ["download", "Downloader"]
__all__ = ["Client"]
17 changes: 9 additions & 8 deletions ecmwf/opendata/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
# granted to it by virtue of its status as an intergovernmental organisation
# nor does it submit to any jurisdiction.
#
import datetime

import itertools
import json
import logging
import os
import re
import json

import requests
from multiurl import download
from multiurl import download, robust

from .date import fulldate

Expand Down Expand Up @@ -101,19 +102,19 @@ def get_parts(self, data_urls, for_index):
base, _ = os.path.splitext(url)
index_url = f"{base}.index"

r = requests.get(index_url)
r = robust(requests.get)(index_url)
r.raise_for_status()


parts = []
for line in r.iter_lines():
line = json.loads(line)
# LOG.debug(line)
matches = 0
for name, values in for_index.items():
if line[name] in values:
matches +=1
if line.get(name) in values:
matches += 1
if matches == count:
parts.append((line['_offset'], line['_length']))
parts.append((line["_offset"], line["_length"]))

if parts:
result.append((url, parts))
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def read(fname):
url="https://github.com/ecmwf/ecmwf-opendata",
packages=setuptools.find_namespace_packages(include=["ecmwf.*"]),
include_package_data=True,
install_requires=["multiurl"],
install_requires=["multiurl>=0.0.6"],
zip_safe=True,
keywords="tool",
classifiers=[
Expand Down

0 comments on commit 010d4f0

Please sign in to comment.