我正在使用python–magento API ,很less有运气build立连接。 这个API试图使用Magento的XML-RPC和连接到社区Magento 1.8 …
我的本地安装在Windows 8上是Python 2.7(64),而Magento是在PHP 5.4上。
Traceback (most recent call last): File "C:/Users/xxx/Documents/PYTHON/magento_test_connect.py", line 2, in <module> magento = MagentoAPI("xxx.com", 80, "userxxx", "passxxx") File "C:\Python27\lib\site-packages\magento\__init__.py", line 20, in __init__ self.login() File "C:\Python27\lib\site-packages\magento\__init__.py", line 59, in login self._session_id = self._client.login(self._api_user, self._api_key) File "C:\Python27\lib\xmlrpclib.py", line 1224, in __call__ return self.__send(self.__name, args) File "C:\Python27\lib\xmlrpclib.py", line 1578, in __request verbose=self.__verbose File "C:\Python27\lib\xmlrpclib.py", line 1264, in request return self.single_request(host, handler, request_body, verbose) File "C:\Python27\lib\xmlrpclib.py", line 1297, in single_request return self.parse_response(response) File "C:\Python27\lib\xmlrpclib.py", line 1473, in parse_response return u.close() File "C:\Python27\lib\xmlrpclib.py", line 793, in close raise Fault(**self._stack[0]) xmlrpclib.Fault: <Fault 2: 'Access denied.'> Process finished with exit code 1
我正在寻找一些方向,但现在我要抛出一个赏金,因为我看到与Python的Magento连接没有很好地logging在networking上。
我已经缩小的代码是…
from magento import * magento = MagentoAPI("xxx.com", 80, "userxxx", "passxxx") magento.help() #just to see some results
去直接的URLpath(检查防火墙问题),我得到…
<methodResponse><fault><value><struct><member><name>faultCode</name><value><int>630</int></value></member><member><name>faultString</name><value><string>Unable to read request</string></value></member></struct></value></fault></methodResponse>
我已经进入Magentopipe理员的所有细节,并给予了完整的权限。 想到使用REST API,但在阅读了这个没有答案的问题之后 ,看起来也有相同的问题。
**
**
import magento url = 'xxx.com' port = 8080 apiuser = 'userxxx' apipass = 'passxxx' with magento.MagentoAPI(url, port, apiuser, apipass) as product_api: order_filter = {'created_at':{'from':'2013-01-15 00:00:00'}} products = product_api.list(order_filter)
错误…
socket.error: [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
Resources: cart: create, info, license, order, totals cart_coupon: add, remove cart_customer: addresses, set cart_payment: list, method cart_product: add, list, moveToCustomerQuote, remove, update cart_shipping: list, method catalog_category: assignProduct, assignedProducts, create, currentStore, delete, info, level, move, removeProduct, tree, update, updateProduct catalog_category_attribute: currentStore, list, options catalog_product: create, currentStore, delete, getSpecialPrice, info, list, listOfAdditionalAttributes, setSpecialPrice, update catalog_product_attribute: addOption, create, currentStore, info, list, options, remove, removeOption, types, update catalog_product_attribute_media: create, currentStore, info, list, remove, types, update catalog_product_attribute_set: attributeAdd, attributeRemove, create, groupAdd, groupRemove, groupRename, list, remove catalog_product_attribute_tier_price: info, update catalog_product_custom_option: add, info, list, remove, types, update catalog_product_custom_option_value: add, info, list, remove, update catalog_product_downloadable_link: add, list, remove catalog_product_link: assign, attributes, list, remove, types, update catalog_product_tag: add, info, list, remove, update catalog_product_type: list cataloginventory_stock_item: list, update core_magento: info core_store: info, list customer: create, delete, info, list, update customer_address: create, delete, info, list, update customer_group: list directory_country: list directory_region: list giftmessage: setForQuote, setForQuoteItem, setForQuoteProduct sales_order: addComment, cancel, hold, info, list, unhold sales_order_creditmemo: addComment, cancel, create, info, list sales_order_invoice: addComment, cancel, capture, create, info, list, void sales_order_shipment: addComment, addTrack, create, getCarriers, info, list, removeTrack, sendInfo Process finished with exit code 0
经过多次测试,1.7的安装工作,而1.8仍然在同一台服务器和配置块下。 唯一的结论是1.8没有完成的API使用和这个问题是(截至6/23/13)1.8 Magento错误。
不知道是否线程鼻祖仍然有问题,但我遇到了与Magento 1.8 python-magento和xmlrpc的问题。
from magento import * m = MagentoAPI('mag1', 80, 'user', 'pass')
失败
<ProtocolError for mag1:80/magento/api/xmlrpc: 404 Not Found>
python-magento中的默认路径是/ magento / api / xmlrpc。
改变这个'/index.php/api/xmlrpc'为我工作:
m = MagentoAPI('mag1', 80, 'user', 'pass', path='/index.php/api/xmlrpc')
成功。
Magento 1.8中新的重写处理引起的问题。 在这里看到更多的信息: 访问时的Magento API错误 。
希望这可以帮助。
杰瑞。