WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@aaxelb
Copy link
Contributor

@aaxelb aaxelb commented Dec 17, 2021

quick lil experiment: use share as a renderer for (potentially private) metadata -- just render on request, don't store anything

all specifics still up in the air

example usage:

import requests

# works for only oai_dc at the moment
url = 'http://localhost:8000/api/v2/pls-render-metadata?metadata_formats=oai_dc'
request_body = [
  {'@id': '_:a', '@type': 'creativework', 'title': 'foo'},
  {
    '@id': '_:b',
    '@type': 'workidentifier',
    'creative_work': {'@id': '_:a', '@type': 'creativework'},
    'uri': 'http://example.com/foo',
  },
]
response = requests.post(url, json.dumps(request_body))
assert response.json() == ['<oai_dc:dc xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd"><dc:title>foo</dc:title><dc:type>creativework</dc:type><dc:identifier>http://example.com/foo</dc:identifier></oai_dc:dc>']

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.03%) to 84.333% when pulling 2070b57 on aaxelb:quest/stateless-metadata-render into c7715af on CenterForOpenScience:develop.

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