Ejemplo n.º 1
0
from future import print_function
from prestapyt import PrestaShopWebService
from xml.etree import ElementTree

prestashop = PrestaShopWebService('http://localhost:8080/api',
                                  'BVWPFFYBT97WKM959D7AVVD0M4815Y1L')
prestashop.debug = True

prestashop.get('')

print("GET")
print((ElementTree.tostring(prestashop.get('addresses'))))
print((ElementTree.tostring(prestashop.get('addresses', resource_id=1))))
print((ElementTree.tostring(prestashop.get('addresses/1'))))
print((ElementTree.tostring(prestashop.get('addresses', options={'limit':
                                                                 1}))))
print((ElementTree.tostring(prestashop.get('stock_movement_reasons'))))

print("HEAD")
print((prestashop.head('addresses')))

print("EDIT")
prestashop.edit(
    "addresses", 1, """<prestashop xmlns:ns0="http://www.w3.org/1999/xlink">
<address>
	<id>1</id>
	<id_customer />
	<id_manufacturer ns0:href="http://localhost:8080/api/manufacturers/1">1</id_manufacturer>
	<id_supplier />
	<id_country ns0:href="http://localhost:8080/api/countries/21">21</id_country>
	<id_state ns0:href="http://localhost:8080/api/states/5">5</id_state>
Ejemplo n.º 2
0
from prestapyt import PrestaShopWebService
from xml.etree import ElementTree


prestashop = PrestaShopWebService('http://localhost:8080/api',
                                  'BVWPFFYBT97WKM959D7AVVD0M4815Y1L')
prestashop.debug = True

prestashop.get('')

print "GET"
print ElementTree.tostring(prestashop.get('addresses'))
print ElementTree.tostring(prestashop.get('addresses', resource_id=1))
print ElementTree.tostring(prestashop.get('addresses/1'))
print ElementTree.tostring(prestashop.get('addresses', options={'limit': 1}))
print ElementTree.tostring(prestashop.get('stock_movement_reasons'))

print "HEAD"
print prestashop.head('addresses')

print "EDIT"
prestashop.edit("addresses", 1, """<prestashop xmlns:ns0="http://www.w3.org/1999/xlink">
<address>
	<id>1</id>
	<id_customer />
	<id_manufacturer ns0:href="http://localhost:8080/api/manufacturers/1">1</id_manufacturer>
	<id_supplier />
	<id_country ns0:href="http://localhost:8080/api/countries/21">21</id_country>
	<id_state ns0:href="http://localhost:8080/api/states/5">5</id_state>
	<alias>manufacturer</alias>
	<company />