text: import requests
  import json
  
  class life360:
      
      base_url = "https://api.life360.com/v3/"
      token_url = "oauth2/token.json"
      circles_url = "circles.json"
      circle_url = "circles/"
  
      def __init__(self, authorization_token=None, username=None, password=None):
          self.authorization_token = authorization_token
          self.username = username
          self.password = password
  
      def make_request(self, url, params=None, method='GET', authheader=None):
          headers = {'Accept': 'application/json'}
          if authheader:
              headers.update({'Authorization': authheader, 'cache-control': "no-cache",})
          
          if method == 'GET':
              r = requests.get(url, headers=headers)
          elif method == 'POST':
              r = requests.post(url, data=params, headers=headers)
  
          return r.json()
  
      def authenticate(self):
          
  
          url = self.base_url + self.token_url
          params = {
              "grant_type":"password",
              "username":self.username,
              "password":self.password,
          }
  
          r = self.make_request(url=url, params=params, method='POST', authheader="Basic " + self.authorization_token)
          try:
              self.access_token = r['access_token']
              return True
          except:
              return False
  
      def get_circles(self):
          url = self.base_url + self.circles_url
          authheader="bearer " + self.access_token
          r = self.make_request(url=url, method='GET', authheader=authheader)
          return r['circles']
  
      def get_circle(self, circle_id):
          url = self.base_url + self.circle_url + circle_id
          authheader="bearer " + self.access_token
          r = self.make_request(url=url, method='GET', authheader=authheader)
          return r
  
     