RESTful Python client such as Guzzle from PHP

Which Python library provides the RESTful client interface, for example:

client = Client(
    base_url="http://example.com/api/1/", auth=("user", "password"),
    cookie=cookielib.FileCookieJar('cookie-file'))
result = client.get('group', params={"groupname": "some_group", "expand": "users"})
result.json()
+5
source share
1 answer

Not quite so, but you probably want queries

change: since you want to skip your base URL try something like this:

base_url = "http://example.com/"
def requests_get(url, *args, **kwargs):
    return requests.get(base_url + url,*args,**kwargs)

An alternative solution is to subclass requests.Sessionas shown in this answer .

+5
source

All Articles