Skip to main content

HTTP REST Client based on requests with dynamic url building

Project description

====
mgun
====

.. image:: https://badge.fury.io/py/mgun.svg
:target: https://pypi.python.org/pypi/mgun
.. image:: https://travis-ci.org/maximdanilchenko/mgun.svg
:target: https://travis-ci.org/maximdanilchenko/mgun
.. image:: https://codecov.io/gh/maximdanilchenko/mgun/branch/master/graph/badge.svg
:target: https://codecov.io/gh/maximdanilchenko/mgun

HTTP REST Json Client based on requests with dynamic url building

Install
-------

::

pip install mgun

Quickstart
----------

.. code-block:: python


from mgun import HttpClient

client = HttpClient('https://httpbin.org', headers={'Authorization': '123'}) # headers - optional

resp = client.anything.api.users[23].address.get({'q': '12'})

print(resp.status) # 200
print(resp.data['url']) # https://httpbin.org/anything/api/users/23/address?q=12
print(resp.data['headers']['Authorization']) # 123


Queries in one session:
----------

.. code-block:: python

with client.session() as s: # also possible: with client.s() as s:
resp1 = client.anything.api.users.get({'limit': '10'}, session=s) # request in this session
client.anything.api.users[23].post({'data': [1, 2, 3]}, s) # shorter
client.anything.api.users[23].patch({'name': 'alex'}, s)



Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

mgun-0.1.6-py2-none-any.whl (4.9 kB view hashes)

Uploaded Python 2

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page