code: def handle_401(self, response, exc=None):
          
          if response.status_code == 401:
              s_auth = response.headers.get('www-authenticate', '')
              if 'digest' not in s_auth.lower():
                  return
              request = response.request
              if not request.headers.get('authorization'):
                  self.options = parse_dict_header(s_auth.replace('Digest ', ''))
                  authorization = self.encode(request.method, request.url)
                  params = request.inp_params.copy()
                  headers = params.pop('headers', [])
                  headers.append(('authorization', authorization))
                  params['headers'] = headers
                  response.request_again = request_again(request.method,
                                                         request.url,
                                                         params)
docs: Takes the given response and tries digest-auth, if needed.