kpbs / py3-pmp-wrapper Goto Github PK
View Code? Open in Web Editor NEWPython3 wrapper for interacting with the Public Media Platform (PMP) API
License: GNU General Public License v2.0
Python3 wrapper for interacting with the Public Media Platform (PMP) API
License: GNU General Public License v2.0
They were in the repo and must have been lost after rebase across merges. They would caught the NavigableDoc.get
method error.
Write tests for navigabledoc
module.
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.
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:
urn:collectiondoc:query:guids
should be removed from tests/fixturesurn:collectiondoc:form:profilesave
should be removed from tests/fixturesurn:collectiondoc:form:schemasave
should be removed from tests/fixturesurn:collectiondoc:form:documentdelete
can now be used to get doc-delete endpoint/methodsurn:collectiondoc:form:listcredentials
+ createcredentials
+ removecredentials
for the cred endpoints/methodsurn:collectiondoc:form:revoketoken
for un-issuing a token (though this isn't a common workflow)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.
Need test coverage for utils.json_utils.
Queries may be failing after gain_access
method called if token has expired. Could be PmpAuth.get_access_token2
? Review and create some edge cases with full integration tests, likely.
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.
Consult PMP docs for reference.
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?
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.
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`.
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")
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.