Pathon 2.7 api/https要求

2024-10-01 09:25:07 发布

您现在位置:Python中文网/ 问答频道 /正文

我想用Python设置一个API/HTTPS请求。这是我得到的文件:

<?xml version="1.0" encoding="UTF-8"?>
<eF:eFulfilmentXML xmlns:eF="http://rt.efulfilment.de/v1s7">
<Authentication>
<Action>GetArticleMasterDataList</Action>
<exchangePointId>999999</exchangePointId>
<user_id>xxxxxx</user_id>
<accessKey>xxxxxx</accessKey>
<FilterNo>XML_RT</FilterNo>
</Authentication>
<GetArticleMasterDataListRequest>
<ChannelId>AMAZON_SC_DE</ChannelId> 
<LangId>DE</LangId> 
<ArticleId>REPLICATION+TEST+TEST</ArticleId>  
<ExportArtRootId>1</ExportArtRootId>
<LastChangeTimestamp>2012-10-31T11:55:41</LastChangeTimestamp> 
<ExportDefaultPrice>1</ExportDefaultPrice>
<ExportGeoData>1</ExportGeoData> 
<ExportSKUOnly>1</ExportSKUOnly> 
<ExportArticleCreated>1</ExportArticleCreated>
<ExportDisplayVariantsOnly>1</ExportDisplayVariantsOnly>
<ExportArticleRootDescription>1</ExportArticleRootDescription>
<ExportArticleRelations>1</ExportArticleRelations>
<ExportBundleContents>1</ExportBundleContents>
<ExportAttributes>
<Attribute>4345</Attribute>
</ExportAttributes>
<ExportAllArticleProperties>1</ExportAllArticleProperties>
<ExportDistTypesForProperties>1</ExportDistTypesForProperties>
<ExportDefaultShippingMediaId>1</ExportDefaultShippingMediaId>
<ExportExternalReferences>
<ReferenceType>EAN</ReferenceType>
</ExportExternalReferences>
<ExportManufacturerData>1</ExportManufacturerData>
<SuppressLongDescription>1</SuppressLongDescription>
<SuppressArticleImages>1</SuppressArticleImages>
<ExportArticleMediaFiles>1</ExportArticleMediaFiles>
<ExportImagesFromArticleRoot>1</ExportImagesFromArticleRoot>
<ExportActiveOnly>1</ExportActiveOnly>
<ExportConsignmentData>1</ExportConsignmentData>
<ExportAdditionalShopInformation>1</ExportAdditionalShopInformation>
<ExportCatalogAssignments>
<CatalogId>TEST-ID</CatalogId>
</ExportCatalogAssignments>
<ExportBasePrices>1</ExportBasePrices>
<FurtherSearchCriteria>
<ArticleId>
<SearchTerm>0</SearchTerm>
<SearchComparison>LI</SearchComparison>
</ArticleId>
<CatalogCategory>
<CatalogId>TEST-ID</CatalogId>
<CategoryId>0</CategoryId>
</CatalogCategory>
<ManufacturerId>101_APPAREL</ManufacturerId>
<ConsignmentId>K4013</ConsignmentId>
<ArticleProperty>
<PropertyId>1</PropertyId>
<PropertyValue>
<SearchTerm>0</SearchTerm>
<SearchComparison>LI</SearchComparison>
</PropertyValue>
</ArticleProperty>
<ArticleAttribute>
<AttributeId>1</AttributeId>
<AttributeValue>
<SearchTerm>0</SearchTerm>
<SearchComparison>LI</SearchComparison>
</AttributeValue>
</ArticleAttribute>            
</FurtherSearchCriteria>       
</GetArticleMasterDataListRequest>
</eF:eFulfilmentXML> 

this是网站。你知道吗

我总是收到这样的错误信息:

<?xml version="1.0" encoding="UTF-8"?>
<ef:eFulfilmentXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ef="http://rt.efulfilment.de/v1s7">
  <ResponseCode>4</ResponseCode>
  <ResponseDescription><![CDATA[
POST parameter 'xml' not hand over. Please transfer your xml by using this POST parameter. Other ways are not possible.
]]></ResponseDescription>
</ef:eFulfilmentXML>

这是Python的第一个开始代码。你知道吗

import urllib2
import requests

url = 'https://sys.staging.efulfilment.de/rt/'
response = requests.get(url, auth=('USER', 'PASSWORD'))
print response.status_code
print response.content

我不知道我的错在哪里。有人能帮帮我吗?你知道吗


Tags: testhttpdelixmlrtefxmlns