vendredi 2 août 2019

Testes passed locally, but on Jenkins Zeep throws 401 Client Error: Unauthorized

I have this error while running tests on Jenkins.

requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://www.w3.org/2005/05/xmlmime

I' ve got this error when the test is using Zeep library to make a SOAP request. But when I run this failed tests locally - everything is fine.

    # get zeep client
    def get_soap_client(self):
        user = "user"
        password = "password"

        settings = self.Settings()
        settings.strict = True
        settings.xml_huge_tree = True
        session = self.Session()
        session.auth = self.HTTPBasicAuth(user, password)

        api = "http://10.150.50.50:3000/service/shop?wsdl"

        client = self.Client(
            wsdl=api,
            settings=settings,
            transport=self.Transport(session=session)
        )

        return user, client

   # perform request
   def get_data():
        user, client = self.get_soap_client()

        response = client.service.getData(
            user=user,
            customerId=customer_id,
        )

        print("\nRESPONSE from get_data")
        print(response)
        return response


Aucun commentaire:

Enregistrer un commentaire