def treq_with_authentication(reactor, ca_path, user_cert_path, user_key_path):
 ca = Certificate.loadPEM(ca_path.getContent())
 user_credential = UserCredential.from_files(user_cert_path, user_key_path)
 policy = ControlServicePolicy(ca_certificate=ca, client_credential=user_credential.credential)
 return HTTPClient(Agent(reactor, contextFactory=policy))

def treq_with_authentication ( reactor , ca_path , user_cert_path , user_key_path ) : ca = Certificate . loadPEM ( ca_path . getContent ( ) ) user_credential = UserCredential . from_files ( user_cert_path , user_key_path ) policy = ControlServicePolicy ( ca_certificate = ca , client_credential = user_credential . credential ) return HTTPClient ( Agent ( reactor , contextFactory = policy ) )
create a treq-api object that implements the rest api tls authentication .