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

@aerickson

Description

@aerickson

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.
➜  ~

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy