Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Mar 18, 2019. It is now read-only.
This repository was archived by the owner on Mar 18, 2019. It is now read-only.

generated python code doesn't work #179

Copy link
Copy link
@aerickson

Description

@aerickson
Issue body actions

Versions I'm using:

coreapi                       2.3.3     
coreapi-cli                   1.0.9  
Python 2.7.16

API I'm trying to use: https://treeherder.mozilla.org/docs/#project-push-list
github repo for the project: https://github.com/mozilla/treeherder

Valid projects are 'try' and 'mozilla-central'. The following work fine.

coreapi get https://treeherder.mozilla.org/docs/
coreapi action project push list -p project=try
coreapi action project push list -p project=mozilla-central

curl "https://treeherder.mozilla.org/api/project/try/push/"
curl "https://treeherder.mozilla.org/api/project/mozilla-central/push/"

The python code (click 'Source Code' in lower left and select python) doesn't work.

test.py (nearly exactly from doc page, just setting project key)

#!/usr/bin/env python

import coreapi

# Initialize a client & load the schema document
client = coreapi.Client()
schema = client.get("https://treeherder.mozilla.org/docs/")

# Interact with the API endpoint
action = ["project", "push > list"]
params = {
    "project": "try",
    #"project": "mozilla-central", 
}
result = client.action(schema, action, params=params)
print(result)
➜  ~  ./test.py 
Traceback (most recent call last):
  File "./test.py", line 14, in <module>
    result = client.action(schema, action, params=params)
  File "/usr/local/lib/python2.7/site-packages/coreapi/client.py", line 163, in action
    link, link_ancestors = _lookup_link(document, keys)
  File "/usr/local/lib/python2.7/site-packages/coreapi/client.py", line 38, in _lookup_link
    raise exceptions.LinkLookupError(msg % (index_string, repr(key).strip('u')))
coreapi.exceptions.LinkLookupError: Index ['project']['push > list'] did not reference a link. Key 'push > list' was not found.
➜  ~

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.