Define API suites declaratively
Project description
# dappy
package to allow defining an API declaratively
## Example
All the API calls below (".get()", ".search()") return a dict parsed with json.loads()
```python
from dappy import API, Endpoint
ItunesAPI = API('itunes.apple.com', [
Endpoint(
'search', '/search',
query_map={ 'search_string': 'term' }, # Map input query params to what the API actually expects
default_query={ 'entity': 'podcast' } # Default query params to send with every request
),
Endpoint('get', '/lookup')
], scheme='https') # scheme defaults to 'https'
ItunesAPI.search(query={
'search_string': 'Hello, World' # 'search_string" will get mapped to 'term' before we send the request
}) # 'entity=podcast' gets added to the query without us providing it here
ItunesAPI.get(query={ 'id': '656270845' })
```
See https://dappy.readthedocs.io/en/latest/usage.html for more usage info.
* Free software: MIT license
* Documentation: https://dappy.readthedocs.io.
=======
History
=======
2.0.1 (2019-01-03)
------------------
* Readme change to clarify the new API expectations
2.0.0 (Who can remember)
------------------
* API now behaves differently.
* no more kwargs on endpoint calls, use `query={}` to pass query params and `params={}` to pass post params
1.0.0 (2017-09-13)
------------------
* First release on PyPI.
package to allow defining an API declaratively
## Example
All the API calls below (".get()", ".search()") return a dict parsed with json.loads()
```python
from dappy import API, Endpoint
ItunesAPI = API('itunes.apple.com', [
Endpoint(
'search', '/search',
query_map={ 'search_string': 'term' }, # Map input query params to what the API actually expects
default_query={ 'entity': 'podcast' } # Default query params to send with every request
),
Endpoint('get', '/lookup')
], scheme='https') # scheme defaults to 'https'
ItunesAPI.search(query={
'search_string': 'Hello, World' # 'search_string" will get mapped to 'term' before we send the request
}) # 'entity=podcast' gets added to the query without us providing it here
ItunesAPI.get(query={ 'id': '656270845' })
```
See https://dappy.readthedocs.io/en/latest/usage.html for more usage info.
* Free software: MIT license
* Documentation: https://dappy.readthedocs.io.
=======
History
=======
2.0.1 (2019-01-03)
------------------
* Readme change to clarify the new API expectations
2.0.0 (Who can remember)
------------------
* API now behaves differently.
* no more kwargs on endpoint calls, use `query={}` to pass query params and `params={}` to pass post params
1.0.0 (2017-09-13)
------------------
* First release on PyPI.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dappy-3.0.3.tar.gz
(14.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dappy-3.0.3.tar.gz.
File metadata
- Download URL: dappy-3.0.3.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
645b57c1fc5023ce0100ace41627f315144da3bb27d26912ce14c666a5027740
|
|
| MD5 |
d3072bbd449073a8c47f3bf3687b6d60
|
|
| BLAKE2b-256 |
bbe383a9d2a11868e2e28d3616af43afef89c6077f2747d468d087df3a9aebd8
|
File details
Details for the file dappy-3.0.3-py2.py3-none-any.whl.
File metadata
- Download URL: dappy-3.0.3-py2.py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba9672e461e125335193cf883fc96000b1a5effbd2189de0f5a7f52929cdd86d
|
|
| MD5 |
bb28d82e30b59f64c1656bf7ed468ce4
|
|
| BLAKE2b-256 |
e47b423cd8416fba469eb1b4eb25795c6e4f8a94ad0aa1c08a1b680f07c1d79f
|