Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/299.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Pathon 2.7 api/https请求_Python_Api_Request - Fatal编程技术网

Python Pathon 2.7 api/https请求

Python Pathon 2.7 api/https请求,python,api,request,Python,Api,Request,我想用Python设置一个API/HTTPS请求。这是我得到的文件: <?xml version="1.0" encoding="UTF-8"?> <eF:eFulfilmentXML xmlns:eF="http://rt.efulfilment.de/v1s7"> <Authentication> <Action>GetArticleMasterDataList</Action> <exchangePointId>999

我想用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> 

我不确定我的错误在哪里。有人能帮我吗?

如您收到的错误消息所示,您必须发布您的请求,而不是获取

使用
response=
而不是
response=requests.get(…)

这篇文章有“xml”参数吗?对于您在提供的url上使用的服务,这似乎是强制性的
<?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>
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