Search code examples
pythonfedex

Fedex Special Rate Request using python-fedex


I am having a problem with fedex rate service request. I need to get the Saturday Delivery rate from fedex. How can i get this? I am using python-fedex module.

I have tried using

rate_request.RequestedShipment.ServiceType = None
rate_request.VariableOptions = 'SATURDAY_DELIVERY'

with other parameters. Please give me some hints. I am just stucked with it.


Solution

  • i dont know with that module. but a saturday delivery rate request looks like this:

    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://fedex.com/ws/rate/v13">
       <SOAP-ENV:Body>
          <RateRequest>
             <WebAuthenticationDetail>
                <UserCredential>
                   <Key></Key>
                   <Password/>
                </UserCredential>
             </WebAuthenticationDetail>
             <ClientDetail>
                <AccountNumber></AccountNumber>
                <MeterNumber></MeterNumber>
             </ClientDetail>
             <TransactionDetail>
                <CustomerTransactionId>RateRequest_Condor_Sat_Del</CustomerTransactionId>
             </TransactionDetail>
             <Version>
                <ServiceId>crs</ServiceId>
                <Major>13</Major>
                <Intermediate>0</Intermediate>
                <Minor>0</Minor>
             </Version>
             <RequestedShipment>
                <ShipTimestamp>2012-08-17T09:30:47-05:00</ShipTimestamp>
                <DropoffType>REGULAR_PICKUP</DropoffType>
                <ServiceType>FIRST_OVERNIGHT</ServiceType>
                <PackagingType>YOUR_PACKAGING</PackagingType>
                <TotalWeight>
                   <Units>LB</Units>
                   <Value>50.0</Value>
                </TotalWeight>
                <Shipper>
                   <AccountNumber></AccountNumber>
                   <Contact>
                      <CompanyName>FedEx-WAPI</CompanyName>
                      <PhoneNumber>1234567890</PhoneNumber>
                   </Contact>
                   <Address>
                      <StreetLines>SN2000 Test Meter 8</StreetLines>
                      <StreetLines>10 Fedex Parkway</StreetLines>
                      <City>COLORADO SPRINGS</City>
                      <StateOrProvinceCode>CO</StateOrProvinceCode>
                      <PostalCode>80915</PostalCode>
                      <CountryCode>US</CountryCode>
                   </Address>
                </Shipper>
                <Recipient>
                   <AccountNumber></AccountNumber>
                   <Contact>
                      <PersonName>Recipient Contact</PersonName>
                      <PhoneNumber>1234567890</PhoneNumber>
                   </Contact>
                   <Address>
                      <StreetLines>Recipient Address Line 1</StreetLines>
                      <StreetLines>Recipient Address Line 2</StreetLines>
                      <City>Minneapolis</City>
                      <StateOrProvinceCode>MN</StateOrProvinceCode>
                      <PostalCode>55411</PostalCode>
                      <CountryCode>US</CountryCode>
                   </Address>
                </Recipient>
                <ShippingChargesPayment>
                   <PaymentType>SENDER</PaymentType>
                   <Payor>
                      <ResponsibleParty>
                         <AccountNumber></AccountNumber>
                         <Tins>
                            <TinType>BUSINESS_STATE</TinType>
                            <Number>123456</Number>
                         </Tins>
                      </ResponsibleParty>
                   </Payor>
                </ShippingChargesPayment>
                <SpecialServicesRequested>
                   <SpecialServiceTypes>SATURDAY_DELIVERY</SpecialServiceTypes>
                </SpecialServicesRequested>
                <LabelSpecification>
                   <LabelFormatType>COMMON2D</LabelFormatType>
                   <ImageType>PNG</ImageType>
                   <LabelStockType>PAPER_4X6</LabelStockType>
                </LabelSpecification>
                <RateRequestTypes>ACCOUNT</RateRequestTypes>
                <PackageCount>1</PackageCount>
                <RequestedPackageLineItems>
                   <SequenceNumber>1</SequenceNumber>
                   <GroupPackageCount>1</GroupPackageCount>
                   <Weight>
                      <Units>LB</Units>
                      <Value>20.0</Value>
                   </Weight>
                   <Dimensions>
                      <Length>12</Length>
                      <Width>12</Width>
                      <Height>12</Height>
                      <Units>IN</Units>
                   </Dimensions>
                   <ContentRecords>
                      <PartNumber>123445</PartNumber>
                      <ItemNumber>kjdjalsro1262739827</ItemNumber>
                      <ReceivedQuantity>12</ReceivedQuantity>
                      <Description>ContentDescription</Description>
                   </ContentRecords>
                </RequestedPackageLineItems>
             </RequestedShipment>
          </RateRequest>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    

    where ShipmentSpecialServiceType is the important part to define -page 37 of the developer manual-:

    Identifies the collection of special services requested by the shipper and offered by FedEx. the shipper requests a special service requiring additional data (such as C.O.D.), the special service type must be present in the SpecialServiceTypes collection, and the supporting detail must be provided in the appropriate sub-object (such as CodDetail).