Skip to content

Error while Using PickupService.py #1

Open
@17YuvrajSehgal

Description

@17YuvrajSehgal

HTTPError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/suds/transport/http.py in send(self, request)
88 log.debug('sending:\n%s', request)
---> 89 fp = self.u2open(u2request, timeout=request.timeout)
90 self.getcookies(fp, u2request)

21 frames
HTTPError: HTTP Error 500: Internal Server Error

During handling of the above exception, another exception occurred:

TransportError Traceback (most recent call last)
TransportError: Internal Server Error

During handling of the above exception, another exception occurred:

WebFault Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/suds/client.py in process_reply(self, reply, status, description)
838 "as an internal server error.", status)
839 if self.options.faults:
--> 840 raise WebFault(fault, replyroot)
841 return http.client.INTERNAL_SERVER_ERROR, fault
842 if status != http.client.OK:

WebFault: Server raised fault: 'Authorization failed -- Service Operation is inactive.'

Code:

`def get_pickup_history():
url = "https://webservices.purolator.com/EWS/V1/PickUp/PickUpService.wsdl"
client = Client(url,username='key',password='pass')

# Create required SOAP headers
Language = client.factory.create('ns0:Language')
RequestContext = client.factory.create('ns0:RequestContext')
RequestContext.Version = '1.2'
RequestContext.GroupID = 'xxx'
RequestContext.RequestReference = 'Pickup Examples'
RequestContext.Language = Language.en

# RequestContext.UserToken = 'YourUserToken'
client.set_options(soapheaders=RequestContext)

#Set SOAP headers
PickUpHistorySearchCriteria = client.factory.create('ns0:PickUpHistorySearchCriteria')

PickUpHistorySearchCriteria.AccountNumber = "334740192201"
PickUpHistorySearchCriteria.ConfirmationNumber = "334740192201"
PickUpHistorySearchCriteria.FromDate = "2024-03-20"
PickUpHistorySearchCriteria.MaxNumOfRecords = 10
PickUpHistorySearchCriteria.ToDate = "2024-06-30"

return client.service.GetPickUpHistory(PickUpHistorySearchCriteria)`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions