8000 Add scripts to download, process and send (POST, PUT, PATCH) Items to… by lukaszlacinski · Pull Request #21 · ESGF/stac-transaction-api · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add scripts to download, process and send (POST, PUT, PATCH) Items to… #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

lukaszlacinski
Copy link
Collaborator

… STAC Trans 8000 action API

This PR creates the new test/ directory. The directory contains:

  • lists of paths to ESGF datasets that will be used in data challenges
  • scripts that
    • get metadata from ESGF1 Search service
    • convert them to STAC Item
    • send (POST, PUT, PATCH) Items to STAC Transaction API.

def patch(self, entry):
collection = entry.get("collection")
item_id = entry.get("id")
headers = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For RFC 6902, we'll likely need another header:

import requests

url = "your_api_endpoint"
headers = {'Content-Type': 'application/json-patch+json'}
patch_data = [
    {"op": "replace", "path": "/key1", "value": "new_value"},
    {"op": "add", "path": "/key2", "value": ["item1", "item2"]},
    {"op": "remove", "path": "/key3"}
]

response = requests.patch(url, headers=headers, json=patch_data)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0