Bronto SOAP API的Python包装器
项目描述
bronto-python
bronto-python是一个Python查询客户端,它以易于使用的方式封装了Bronto SOAP API,使用suds库。
入门
from bronto.client import Client
client = Client('BRONTO_API_TOKEN')
client.login()
就这么简单!
联系人
添加联系人
contact_data = {'email': 'me@domain.com',
'source': 'api',
'customSource': 'Using bronto-python to import my contact'}
client.add_contact(contact_data)
检索联系人
client.get_contact('me@domain.com')
删除联系人
client.delete_contact('me@domain.com')
订单
添加订单
order_data = {'id': 'xyz123',
'email': 'me@domain.com',
'products': [
{'id': 1,
'sku': '1111',
'name': 'Test Product 1',
'description': 'This is our first test product.',
'quantity': 1,
'price': 3.50},
{'id': 2,
'sku': '2222',
'name': 'Second Test Product',
'description': 'Here we have another product for testing.',
'quantity': 12,
'price': 42.00}
]
}
client.add_order(order_data)
删除订单
client.delete_order('xyz123') # Orders are deleted by their orderId
字段
添加字段
field_data = {'name': 'my_field',
'label': 'My Field',
'type': 'text',
'visible': 'private'
}
client.add_field(field_data)
检索字段
client.get_field('my_field')
删除字段
field = client.get_field('my_field')
client.delete_field(field.id)
列表
添加列表
list_data = {'name': 'my_list',
'label': 'My List'
}
client.add_list(list_data)
检索列表
client.get_list('my_list')
删除列表
list_to_del = client.get_list('my_list')
client.delete_field(list_to_del.id)
注意:此客户端并非针对长时间运行的过程构建。Bronto API连接将在20分钟的空闲后超时,并且此客户端无法处理这些超时。
项目详情
关闭
bronto-python-0.8.0.tar.gz 的散列值
算法 | 散列摘要 | |
---|---|---|
SHA256 | f970121473cae58f148868f88aed219489c66e97b5bbf4a541e73f656c0f2dcb |
|
MD5 | b5b990aa00d84c28f279e09f0d8d4416 |
|
BLAKE2b-256 | 1ea3bf6f2c64c9d1d5aea9978da898ea5ef2a0a6142f0dfac20865265f5c8d68 |