Reputation: 353
What Python library provides RESTful client interface like:
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()
Upvotes: 6
Views: 3640
Reputation: 27333
Not exactly like that, but you likely want requests
edit: since you want to ommit 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.Session
as shown in this answer.
Upvotes: 8