Skip to content

Rework support for bulk requests #10

@plaes

Description

@plaes

With current "hacky" implementation one can do this, but it needs to be improved:

auth = ErplyAuth(ERPLY_CUSTOMER_CODE,
                 ERPLY_USERNAME,
                 ERPLY_PASSWORD)
erply = Erply(auth)

request = ErplyBulkRequest(erply, json.dumps)

items = [
        {'price': 1, 'id': 1, 'gid': 1},
        {'price': 2, 'id': 2, 'gid': 1},
        {'price': 3, 'id': 3, 'gid': 1},
]

# Build requests 
for item in items:
        request.attach('saveProduct', **{'priceWithVAT': item['price']
                                         'productID':  item['id'],
                                         'groupID': item['gid'],}
        )
# Make the call
response = request()

# Deal with responses
for r in r.response.records:
        # This part sucks with current implementation :D
        print (r[0])

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions