davidhuser / dhis2.py

Generic and lightweight Python wrapper for the DHIS2 API using requests
MIT License
15 stars 11 forks source link

request param validation should accept lists of tuples #4

Closed ewheeler closed 6 years ago

ewheeler commented 6 years ago

Thanks for the lovely library!

I found a limitation that should be simple to fix. Many DHIS2 API endpoints allow repeated parameters, but this library does not.

For example, table 1.29 in the 1.17.6. Reading data values section of DHIS2 API docs describes several parameters that "Can be repeated any number of times." (such as dataSet, orgUnit, period, etc)

Luckily, the requests library supports repeated parameters if the caller provides as a list of tuples: http://docs.python-requests.org/en/latest/user/quickstart/#more-complicated-post-requests

However, the _validate_request method raises if params is not a dict

davidhuser commented 6 years ago

Valid point I have not thought about! It's enabled on 1.5.0 in commit https://github.com/davidhuser/dhis2.py/commit/e4484f60cd2e31a5763f190d78b50b8e9d3673b1. Thanks!

davidhuser commented 6 years ago

docs example here: https://github.com/davidhuser/dhis2.py#multiple-params

ewheeler commented 6 years ago

@davidhuser thanks for the quick fix!! much appreciated!!