Giter Site home page Giter Site logo

Comments (2)

vincentsarago avatar vincentsarago commented on June 8, 2024 1

@nmochar2 the fetch_options is a dictionary of options that will be forwarded to either the httpx.get or boto3.s3 methods

@cached( # type: ignore
LRUCache(maxsize=512),
key=lambda filepath, **kargs: hashkey(filepath, json.dumps(kargs)),
)
def fetch(filepath: str, **kwargs: Any) -> Dict:
"""Fetch STAC items.
A LRU cache is set on top of this function.
Args:
filepath (str): STAC item URL.
kwargs (any): additional options to pass to client.
Returns:
dict: STAC Item content.
"""
parsed = urlparse(filepath)
if parsed.scheme == "s3":
bucket = parsed.netloc
key = parsed.path.strip("/")
return json.loads(aws_get_object(bucket, key, **kwargs))
elif parsed.scheme in ["https", "http", "ftp"]:
resp = httpx.get(filepath, **kwargs)
resp.raise_for_status()
return resp.json()
else:
with open(filepath, "r") as f:
return json.load(f)

see https://www.python-httpx.org for the options available for httpx

from rio-tiler.

nmochar2 avatar nmochar2 commented on June 8, 2024

Thank you! I was able to pass the cert using the verify option

STACReader(input=uri, fetch_options={"verify": "ssl.crt"})

from rio-tiler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.