A concrete implementation of StacIO.read_text
. Converts the source
argument to a string (if it is not already) and delegates to DefaultStacIO.read_text_from_href()
for opening and reading the file.
Reads file as a UTF-8 string.
If href
has a “scheme” (e.g. if it starts with “https://”) then this will use urllib.request.urlopen()
(or func:urllib3.request if available) to open the file and read the contents; otherwise, open()
will be used to open a local file.
href – The URI of the file to open.
A concrete implementation of StacIO.write_text
. Converts the dest
argument to a string (if it is not already) and delegates to W:meth:~pystac.stac_io.DefaultStacIO.write_text_to_href for opening and reading the file.
Writes text to file using UTF-8 encoding.
This implementation uses open()
and therefore can only write to the local file system.
href – The path to which the file will be written.
txt – The string content to write to the file.
A mixin for pystac.StacIO
implementations that will report on duplicate keys in the JSON being read in.
Overwrites StacIO.json_loads
as the internal method used by DuplicateKeyReportingMixin
for deserializing a JSON string to a dictionary while checking for duplicate object keys.
pystac.DuplicateObjectKeyError – If a duplicate object key is found.
Overwrites StacIO.read_json
for deserializing a JSON file to a dictionary while checking for duplicate object keys.
pystac.DuplicateObjectKeyError – If a duplicate object key is found.
A customized StacIO that retries requests, using urllib3.util.retry.Retry
.
The headers are passed to DefaultStacIO
. If retry is not provided, a default retry is used.
To use this class, you’ll need to install PySTAC with urllib3:
pip install pystac[urllib3]
Reads file as a UTF-8 string, with retry support.
href – The URI of the file to open.
The urllib3.util.retry.Retry
to use with all reading network requests.
Method used internally by StacIO
instances to serialize a dictionary to a JSON string.
This method may be overwritten in StacIO
sub-classes to provide custom serialization logic. The method accepts arbitrary keyword arguments. These are not used by the default implementation, but may be used by sub-class implementations.
json_dict – The dictionary to serialize
Method used internally by StacIO
instances to deserialize a dictionary from a JSON string.
This method may be overwritten in StacIO
sub-classes to provide custom deserialization logic. The method accepts arbitrary keyword arguments. These are not used by the default implementation, but may be used by sub-class implementations.
txt – The JSON string to deserialize to a dictionary.
Read a dict from the given source.
See StacIO.read_text
for usage of str vs Link as a parameter.
source – The source from which to read.
*args – Additional positional arguments to be passed to StacIO.read_text()
.
**kwargs – Additional keyword arguments to be passed to StacIO.read_text()
.
A dict representation of the JSON contained in the file at the given source.
Read a STACObject from a JSON file at the given source.
See StacIO.read_text
for usage of str vs Link as a parameter.
source – The source from which to read.
root – Optional root of the catalog for this object. If provided, the root’s resolved object cache can be used to search for previously resolved instances of the STAC object.
*args – Additional positional arguments to be passed to StacIO.read_json()
.
**kwargs – Additional keyword arguments to be passed to StacIO.read_json()
.
The deserialized STACObject from the serialized JSON contained in the file at the given uri.
Read text from the given URI.
The source to read from can be specified as a string or os.PathLike
object (Link
is a path-like object). If it is a string, it must be a URI or local path from which to read. Using a Link
enables implementations to use additional link information, such as paging information contained in the extended links described in the STAC API spec.
source – The source to read from.
*args – Arbitrary positional arguments that may be utilized by the concrete implementation.
**kwargs – Arbitrary keyword arguments that may be utilized by the concrete implementation.
The text contained in the file at the location specified by the uri.
Write a dict to the given URI as JSON.
See StacIO.write_text
for usage of str vs Link as a parameter.
dest – The destination file to write the text to.
json_dict – The JSON dict to write.
*args – Additional positional arguments to be passed to StacIO.json_dumps()
.
**kwargs – Additional keyword arguments to be passed to StacIO.json_dumps()
.
Set the default StacIO instance to use.
Deserializes a STACObject
sub-class instance from a dictionary.
d – The dictionary to deserialize
href – Optional href to associate with the STAC object
root – Optional root Catalog
to associate with the STAC object.
preserve_dict – If False
, the dict parameter d
may be modified during this method call. Otherwise the dict is not mutated. Defaults to True
, which results results in a deepcopy of the parameter. Set to False
when possible to avoid the performance hit of a deepcopy.
Write the given text to a file at the given URI.
The destination to write to can be specified as a string or os.PathLike
object (Link
is a path-like object). If it is a string, it must be a URI or local path from which to read. Using a Link
enables implementations to use additional link information.
dest – The destination to write to.
txt – The text to write.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4