2017-01-06 5 views
0

私はPythonでAPI/HTTPSリクエストを設定したいと思います。これは私が持っているドキュメントです:Pathon 2.7 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 

私の間違いはどこにあるのかわかりません。誰かが私を助けてくれますか?

答えて

0

あなたが得たエラーメッセージに示されているように、あなたがあなたのリクエストをPOSTする必要があり、
使用をGETしませresponse =requests.post(...)代わりresponse = requests.get(...)

+0

の私は同じを持っているrequest.post(...)を使用していていた場合エラーメッセージ...... :-( –

+0

POSTに 'xml'パラメータがありましたか?提供されているURLで使用しているサービスでは必須です –