Skip to content

etherisc/rest-client-with-auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

REST Client with Auth

Environment

To run this python test client the following environment is assumed

  • Python (version 3.9 or higher)
  • Python requests library
  • A .env file

The .env File

Copy the file dotenv into .env and fill in the parameter values for client ID and client secret.

Sample Session

Below a sample python session is provided

>>>
from client import fetch_auth_token, post_policy
from client import fetch_auth_token, post_policy

token_response = fetch_auth_token()
token = token_response['access_token']

policy = {
  'name': 'babettli',
  'phone': '079 987 6543',
  'premium': 101,
  'suminsured': 1200
}

response = post_policy(token, policy)

print('policy: {}'.format(policy))
print('response: {} {} {}'.format(response.status_code, response.reason, response.json()))

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages