This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"data":[ | |
{ | |
"type":"institutions", | |
"id":"668407621f7f70000a72c7a2" | |
} | |
], | |
"links":{ | |
"self":"http://localhost:8000/v2/preprints/vnbcp/", | |
"html":"http://localhost:8000/v2/preprints/vnbcp/institutions/" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"data": [ | |
{ | |
"type": "institutions", | |
"id": "<institution_id>" | |
} | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"data":[ | |
{ | |
"id":"667ad190c7ea910017f88d59", | |
"type":"institutions", | |
"attributes":{ | |
"name":"Waters LLC", | |
"description":"", | |
"iri":"https://nicholson.com/", | |
"ror_iri":"https://nixon.com/", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
**GET v2/preprints/(?P<preprint_id>\w+)/institutions/$** | |
---- | |
Returns all institutional affiliations available on a Preprint. | |
* **URL Params** | |
TBD filter/sort params? | |
* **Data Params** | |
None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[2024-05-30 17:30:21,851: INFO/MainProcess] sync with celery@878df8371eaa | |
[2024-05-30 17:30:21,969: ERROR/MainProcess] Received unregistered task of type 'addon_service.listeners.listen_to_queue_route'. | |
The message has been ignored and discarded. | |
Did you remember to import the module containing this task? | |
Or maybe you're using relative imports? | |
Please see | |
http://docs.celeryq.org/en/latest/internals/protocol.html | |
for more information. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def check_access(node, auth, action, cas_resp): | |
"""Verify that user can perform requested action on resource. Raise appropriate | |
error code if action cannot proceed. | |
""" | |
permission = permission_map.get(action, None) | |
if permission is None: | |
raise HTTPError(http_status.HTTP_400_BAD_REQUEST) | |
# Permissions for DraftNode should be based upon the draft registration | |
if isinstance(node, DraftNode): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Traceback (most recent call last): | |
File "/usr/local/lib/python3.12/threading.py", line 1073, in _bootstrap_inner | |
self.run() | |
File "/usr/local/lib/python3.12/threading.py", line 1010, in run | |
self._target(*self._args, **self._kwargs) | |
File "/usr/local/lib/python3.12/site-packages/django/utils/autoreload.py", line 64, in wrapper | |
fn(*args, **kwargs) | |
File "/usr/local/lib/python3.12/site-packages/django/core/management/commands/runserver.py", line 125, in inner_run | |
autoreload.raise_last_exception() | |
File "/usr/local/lib/python3.12/site-packages/django/utils/autoreload.py", line 87, in raise_last_exception |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, request, redirect, session | |
import requests | |
import uuid | |
app = Flask(__name__) | |
app.secret_key = 'your_secret_key' # Needed for session management | |
# Register with the oauth provider and change the credentials to match. | |
CLIENT_ID = '<change>' | |
CLIENT_SECRET = '<change>' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, request, jsonify, redirect, render_template_string | |
from uuid import uuid4 | |
app = Flask(__name__) | |
# In-memory database simulation | |
clients = {} # Registered clients {client_id: client_secret} | |
auth_codes = {} # Authorization codes {code: client_id} | |
tokens = {} # Tokens {access_token: client_id} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rest_framework import ( | |
exceptions, | |
permissions, | |
) | |
from addon_service.models import ( | |
ResourceReference, | |
UserReference, | |
) | |
from app.authentication import authenticate_resource |