Code Monkey home page Code Monkey logo

py3-pmp-wrapper's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

py3-pmp-wrapper's Issues

<Navigable Doc: None> for homedoc

When requesting the home-doc, the client returns <Navigable Doc: None>, which is confusing. It should use some logic to know that the homedoc has no navigation, or for pages without navigation, it sets the current page url to last requested.

Updates to PMP home doc links

An upcoming release to the PMP will introduce some changes to home document links. Changes have already been deployed to https://api-sandbox.pmp.io. Here's my synopsis of what needs to happen for this SDK:

Breaking changes:

  • none

Cleanup changes:

  • regenerate fixtures
  • urn:collectiondoc:query:guids should be removed from tests/fixtures
  • urn:collectiondoc:form:profilesave should be removed from tests/fixtures
  • urn:collectiondoc:form:schemasave should be removed from tests/fixtures

Possible upgrades:

  • urn:collectiondoc:form:documentdelete can now be used to get doc-delete endpoint/methods
  • urn:collectiondoc:form:listcredentials + createcredentials + removecredentials for the cred endpoints/methods
  • urn:collectiondoc:form:revoketoken for un-issuing a token (though this isn't a common workflow)

Confusing Exception from requests on invalid query

The following exception pops on a bad query:

>>> doc.query("urn:collectiondoc:query:documents", params={'tag': 'npr_api', 'profile': 'story'})
requests.exceptions.MissingSchema: Invalid URL 'None': No schema supplied. Perhaps you meant http://None?

This is not that helpful. The query urn is not present in the document. Check for None before attempting to make a request and alert the user that the URN is bad before requests creates this confusing exception.

Fix docstring for NavigableDoc.query

It says to use query_template which has been renamed to template. The class' docstring has been fixed in feature branch, but review docstrings on all methods.

client.home should be able to be requested without an accesstoken

Homedoc is an unprotected endpoint in order to serve token information. However, when it is requested before gain_access method, a NoToken exception is raised even though a token is unnecessary for requesting homedoc.

Maybe bypass NoToken for requesting homedoc?

Seems like work-flow should be: instantiate Client, call gain_access. After that, everything else is possible. Would addressing this lead to a potentially confusing work-flow?

Use of Boolean "AND" in params value raises 'BadRequest' exception

The following should be a valid query param as a per PMP docs:

cl.query('urn:collectiondoc:query:docs', params={'tag': 'npr_api,APM'})
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "~/.virtualenvs/someproject/lib/python3.3/site-packages/py3-pmp-wrapper/pmp_api/pmp_client.py", line 124, in query
    return self.get(self.document.query(rel_type, params=params))
  File "~/.virtualenvs/someproject/lib/python3.3/site-packages/py3-pmp-wrapper/pmp_api/pmp_client.py", line 113, in get
    results = self.connector.get(endpoint)
  File "~/.virtualenvs/someproject/lib/python3.3/site-packages/py3-pmp-wrapper/pmp_api/core/conn.py", line 92, in get
    raise BadRequest(errmsg)
pmp_api.core.exceptions.BadRequest

However, it raises a BadRequest. Does it not receive a valid response? Is the status-code bad? If so, it shouldn't be listed as BadRequest, but there should be some alternate response.

Params with a semicolon pass validation, but those with a comma do not. Please address this issue so boolean values are respected in parameters or error message provides more information as to what went wrong.

TypeError: get() takes 1 positional argument but 2 were given

Document's get method not working:

document.get('tags', '')
Traceback (most recent call last):
  File "<console>", line 1, in <module>
TypeError: get() takes 1 positional argument but 3 were given

This is because parameters are not specified in the method definition:

def get(self):
        return self.collectiondoc.get

Whereas dict's get method would accept params. Copy params from dict's get method or use_args, *_kwargs`.

test_pager.py periodically failing

It fails inconsistently, but why? Investigate and repair.

FAIL: test_paging_docs_doc (test_pager.TestPager)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "~/.virtualenvs/SOMEPROJ/lib/python3.3/site-packages/py3-pmp-wrapper/test/test_pager.py", line 38, in test_paging_docs_doc
    self.assertEqual(actual_vals['current'], self.pager.current)
nose.proxy.AssertionError: 'http://127.0.0.1:8080/docs?offset=10' != 'http://127.0.0.1:8080/docs?guid=someGUID'
- http://127.0.0.1:8080/docs?offset=10
?                             ^^^ ^^^^
+ http://127.0.0.1:8080/docs?guid=someGUID
?                            ++++++ ^ ^^^^

    """Fail immediately, with the given message."""
>>  raise self.failureException("'http://127.0.0.1:8080/docs?offset=10' != 'http://127.0.0.1:8080/docs?guid=someGUID'\n- http://127.0.0.1:8080/docs?offset=10\n?                             ^^^ ^^^^\n+ http://127.0.0.1:8080/docs?guid=someGUID\n?                            ++++++ ^ ^^^^\n")

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.