Function
_get
(
use_async,
filter,
base_url,
max_results_per_provider,
output_file,
count,
list_properties,
search_property,
response_fields,
sort,
endpoint,
pretty_print,
silent,
include_providers,
exclude_providers,
exclude_databases,
verbosity,
skip_ssl,
http_timeout,
**kwargs,
)
Source from the content-addressed store, hash-verified
| 157 | |
| 158 | |
| 159 | def _get( |
| 160 | use_async, |
| 161 | filter, |
| 162 | base_url, |
| 163 | max_results_per_provider, |
| 164 | output_file, |
| 165 | count, |
| 166 | list_properties, |
| 167 | search_property, |
| 168 | response_fields, |
| 169 | sort, |
| 170 | endpoint, |
| 171 | pretty_print, |
| 172 | silent, |
| 173 | include_providers, |
| 174 | exclude_providers, |
| 175 | exclude_databases, |
| 176 | verbosity, |
| 177 | skip_ssl, |
| 178 | http_timeout, |
| 179 | **kwargs, |
| 180 | ): |
| 181 | if output_file: |
| 182 | output_file_path = pathlib.Path(output_file) |
| 183 | try: |
| 184 | output_file_path.touch(exist_ok=False) |
| 185 | except FileExistsError: |
| 186 | raise SystemExit( |
| 187 | f"Desired output file {output_file} already exists, not overwriting." |
| 188 | ) |
| 189 | |
| 190 | args = { |
| 191 | "base_urls": base_url, |
| 192 | "use_async": use_async, |
| 193 | "max_results_per_provider": max_results_per_provider, |
| 194 | "include_providers": {_.strip() for _ in include_providers.split(",")} |
| 195 | if include_providers |
| 196 | else None, |
| 197 | "exclude_providers": {_.strip() for _ in exclude_providers.split(",")} |
| 198 | if exclude_providers |
| 199 | else None, |
| 200 | "exclude_databases": {_.strip() for _ in exclude_databases.split(",")} |
| 201 | if exclude_databases |
| 202 | else None, |
| 203 | "silent": silent, |
| 204 | "skip_ssl": skip_ssl, |
| 205 | } |
| 206 | |
| 207 | # Only set http timeout if its not null to avoid overwriting or duplicating the |
| 208 | # default value set on the OptimadeClient class |
| 209 | if http_timeout: |
| 210 | args["http_timeout"] = http_timeout |
| 211 | |
| 212 | args["verbosity"] = verbosity |
| 213 | |
| 214 | client = OptimadeClient( |
| 215 | **args, |
| 216 | **kwargs, |