使用python-fedex的Fedex特殊费率请求

时间:2013-08-31 15:23:56

标签: python fedex

我遇到了联邦快递费率服务请求的问题。我需要从联邦快递获得星期六交付率。我怎么能得到这个?我正在使用python-fedex模块。

我尝试过使用

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

带有其他参数。请给我一些提示。我只是被它搞砸了。

3 个答案:

答案 0 :(得分:1)

我不知道那个模块。但周六的交货率要求如下:

<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>

其中ShipmentSpecialServiceType是定义开发人员手册第37页的重要部分:

  

标识托运人要求的特殊服务集合   由FedEx提供。托运人要求提供特殊服务   附加数据(如C.O.D.),特殊服务类型必须   存在于SpecialServiceTypes集合中,以及支持   必须在适当的子对象中提供细节(例如   CodDetail)。

答案 1 :(得分:0)

我会看看Shiprush SDK。它有一个SOAP入口点,您可以为fedex和其他运营商评级和发货。 (并且他们支持它。)

答案 2 :(得分:0)

rate_request.derivedData.commitDetail.proofOfDeliveryDayOfWeek ='SATURDAY'

这将解决您的python-fedex问题