https://github.com/andrewannex/planet-crs-registry-client
openapi auto-generated client for planet-crs-registry
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (8.1%) to scientific vocabulary
Repository
openapi auto-generated client for planet-crs-registry
Basic Info
- Host: GitHub
- Owner: AndrewAnnex
- License: mit
- Language: Python
- Default Branch: main
- Size: 27.3 KB
Statistics
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
planet-crs-registry-client
A client library for accessing planetcrsregistry
Usage
First, create a client:
```python from planetcrsregistry_client import Client
client = Client(base_url="https://api.example.com") ```
If the endpoints you're going to hit require authentication, use AuthenticatedClient instead:
```python from planetcrsregistry_client import AuthenticatedClient
client = AuthenticatedClient(base_url="https://api.example.com", token="SuperSecretToken") ```
Now call your endpoint and use your models:
```python from planetcrsregistryclient.models import MyDataModel from planetcrsregistryclient.api.mytag import getmydatamodel from planetcrsregistry_client.types import Response
with client as client: mydata: MyDataModel = getmydatamodel.sync(client=client) # or if you need more info (e.g. statuscode) response: Response[MyDataModel] = getmydatamodel.sync_detailed(client=client) ```
Or do the same thing with an async version:
```python from planetcrsregistryclient.models import MyDataModel from planetcrsregistryclient.api.mytag import getmydatamodel from planetcrsregistry_client.types import Response
async with client as client: mydata: MyDataModel = await getmydatamodel.asyncio(client=client) response: Response[MyDataModel] = await getmydatamodel.asynciodetailed(client=client) ```
By default, when you're calling an HTTPS API it will attempt to verify that SSL is working correctly. Using certificate verification is highly recommended most of the time, but sometimes you may need to authenticate to a server (especially an internal server) using a custom certificate bundle.
python
client = AuthenticatedClient(
base_url="https://internal_api.example.com",
token="SuperSecretToken",
verify_ssl="/path/to/certificate_bundle.pem",
)
You can also disable certificate validation altogether, but beware that this is a security risk.
python
client = AuthenticatedClient(
base_url="https://internal_api.example.com",
token="SuperSecretToken",
verify_ssl=False
)
Things to know:
1. Every path/method combo becomes a Python module with four functions:
1. sync: Blocking request that returns parsed data (if successful) or None
1. sync_detailed: Blocking request that always returns a Request, optionally with parsed set if the request was successful.
1. asyncio: Like sync but async instead of blocking
1. asyncio_detailed: Like sync_detailed but async instead of blocking
- All path/query params, and bodies become method arguments.
- If your endpoint had any tags on it, the first tag will be used as a module name for the function (my_tag above)
- Any endpoint which did not have a tag will be in
planet_crs_registry_client.api.default
Advanced customizations
There are more settings on the generated Client class which let you control more runtime behavior, check out the docstring on that class for more info. You can also customize the underlying httpx.Client or httpx.AsyncClient (depending on your use-case):
```python from planetcrsregistry_client import Client
def log_request(request): print(f"Request event hook: {request.method} {request.url} - Waiting for response")
def logresponse(response): request = response.request print(f"Response event hook: {request.method} {request.url} - Status {response.statuscode}")
client = Client( baseurl="https://api.example.com", httpxargs={"eventhooks": {"request": [logrequest], "response": [log_response]}}, )
Or get the underlying httpx client to modify directly with client.gethttpxclient() or client.getasynchttpx_client()
```
You can even set the httpx client directly, but beware that this will override any existing settings (e.g., base_url):
```python import httpx from planetcrsregistry_client import Client
client = Client( base_url="https://api.example.com", )
Note that base_url needs to be re-set, as would any shared cookies, headers, etc.
client.sethttpxclient(httpx.Client(base_url="https://api.example.com", proxies="http://localhost:8030")) ```
Owner
- Name: Dr. Andrew Annex
- Login: AndrewAnnex
- Kind: user
- Location: Pasadena, CA
- Company: SETI Institute
- Website: http://andrewannex.com
- Twitter: AndrewAnnex
- Repositories: 179
- Profile: https://github.com/AndrewAnnex
Coder and Planetary Science PhD from Johns Hopkins University. Fmr Postdoc @ Caltech, Current Senior Science Systems Engineer @ SETI Institute
GitHub Events
Total
- Release event: 2
- Watch event: 1
- Delete event: 1
- Push event: 5
- Create event: 2
Last Year
- Release event: 2
- Watch event: 1
- Delete event: 1
- Push event: 5
- Create event: 2
Packages
- Total packages: 1
-
Total downloads:
- pypi 22 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 1
- Total maintainers: 1
pypi.org: planet-crs-registry-client
A client library for accessing planet_crs_registry
- Documentation: https://planet-crs-registry-client.readthedocs.io/
- License: MIT License Copyright (c) 2024 Andrew Annex Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
Latest release: 0.1.0
published over 1 year ago
Rankings
Maintainers (1)
Dependencies
- attrs >=21.3.0
- httpx >=0.20.0,<0.28.0
- python ^3.8
- python-dateutil ^2.8.0