Giter VIP home page Giter VIP logo

bronto-python's Introduction

bronto-python

bronto-python is a python query client which wraps the Bronto SOAP API in an easy to use manner, using the suds library.

image

image

image

Getting Started

from bronto.client import Client

client = Client('BRONTO_API_TOKEN')
client.login()

Simple as that!

Contacts

Adding a Contact

contact_data = {'email': '[email protected]',
                'source': 'api',
                'customSource': 'Using bronto-python to import my contact'}
client.add_contact(contact_data)

Retrieving a contact

client.get_contact('[email protected]')

Deleting a contact

client.delete_contact('[email protected]')

Orders

Adding an order

order_data = {'id': 'xyz123',
              'email': '[email protected]',
              '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)

Deleting an order

client.delete_order('xyz123')  # Orders are deleted by their orderId

FIELDS

Adding a field

field_data = {'name': 'my_field',
              'label': 'My Field',
              'type': 'text',
              'visible': 'private'
              }
client.add_field(field_data)

Retrieving a field

client.get_field('my_field')

Deleting a field

field = client.get_field('my_field')
client.delete_field(field.id)

LISTS

Adding a list

list_data = {'name': 'my_list',
              'label': 'My List'
              }
client.add_list(list_data)

Retrieving a list

client.get_list('my_list')

Deleting a list

list_to_del = client.get_list('my_list')
client.delete_field(list_to_del.id)

NOTE: This client is not built with long-running processes in mind. The Bronto API connection will time out after 20 minutes of inactivity, and this client does NOT handle those timeouts.

bronto-python's People

Contributors

tarkatronic avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.