Skip to content

sujeetkv/api-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

api-client

Simple Client for API requests

How to use

from api_client import APIClient
from api_client.auth import TokenAuth


client = APIClient('https://httpbin.org')
res1 = client.get('/anything/one')
res2 = client.get('/anything/two')
client.close_session()

# as a context manager
with APIClient('https://httpbin.org') as client:
    res1 = client.get('/anything/one')
    res2 = client.get('/anything/two')

# for HTTP Basic auth request
client = APIClient('https://httpbin.org', auth=('username', 'password'))

# for token auth request
client = APIClient('https://httpbin.org', auth=TokenAuth('validtokenstring'))

Releases

No releases published

Packages

No packages published

Languages