Skip to content
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

Creating an extractor using a POST request causes a 500 error #1277

Open
tingard opened this issue Mar 24, 2021 · 1 comment
Open

Creating an extractor using a POST request causes a 500 error #1277

tingard opened this issue Mar 24, 2021 · 1 comment

Comments

@tingard
Copy link

tingard commented Mar 24, 2021

When attempting to create an external extractor using the API, the following request returns a 500 error (although the extractor is created successfully).

from panoptes_client import Panoptes

WORKFLOW_ID = 12345
EXTRACTOR_KEY = 'my-amazing-extractor'
EXTERNAL_URL = "https://www.myawesomeapi.com/caesar"

client = Panoptes.connect(
    redirect_url='https://caesar.zooniverse.org/auth/zooniverse/callback',
)

extractor_creation_response = client.http_request(
    method='POST',
    endpoint='https://caesar.zooniverse.org',
    path=f'workflows/{WORKFLOW_ID}/extractors',
    json={
        "extractor": {
            "key": EXTRACTOR_KEY,
            "type": "external",
            "url": EXTERNAL_URL,
        },
    },
    headers={'Accept': 'application/json'}
)

@camallen suggested that this is due to this line erroring and that a fix would be to instead use

format.json { render json: @extractor }

with the specs being updated accordingly.

@tingard
Copy link
Author

tingard commented Mar 24, 2021

(The motivation behind using the panoptes_client is to handle authentication)

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

No branches or pull requests

1 participant