Skip to main content

sdk for getting product information

Project description

villaInventorySdk

read and write inventory in real time

Install

pip install villaInventorySdk

How to use

Uploading a large amount of data

sample input

input = [
    {'ib_brcode': '1023',
     'ib_cf_qty': '835',
     'ib_prcode': '84621',
     'new_ib_vs_stock_cv': '839'},
    {'ib_brcode': '1022',
     'ib_cf_qty': '24',
     'ib_prcode': '12424',
     'new_ib_vs_stock_cv': '21'}
]

Upload data

from villaInventorySdk.inventory import InventorySdk
from random import randrange
import boto3
from dataclasses import dataclass
from dataclasses_json import dataclass_json
from datetime import datetime
t0 = datetime.now()
print(f'uploading {len(input)} items')
sdk = InventorySdk(user=USER, pw=PW)
result = sdk.updateWithS3(
    input,
    inputBucketName= 'input-bucket-dev-manual', 
    functionName= 'update-inventory-s3-dev-manual',
    invocationType = 'RequestResponse'
  )
dt = datetime.now()-t0
print(f'it took {dt.seconds} s')
uploading 2 items
data was saved to s3
data is saved to s3, invoking ingestion function
input to lambda is {'inputBucketName': 'input-bucket-dev-manual', 'inputKeyName': 'input-data-name'}
it took 1 s

Query single product

import json
sdk = InventorySdk(user=USER, pw=PW)
result = sdk.querySingleProduct(ib_prcode = '84621')
json.loads(result)
{'statusCode': 200,
 'inventory': '{"1023": {"ib_cf_qty": 835, "new_ib_bs_stock_cv": 839, "lastUpdate": 1601394614.340882}, "lastUpdate": 1601394614.340882, "ib_prcode": "84621"}'}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

villaProductSdk-0.0.1.tar.gz (12.4 kB view hashes)

Uploaded Source

Built Distribution

villaProductSdk-0.0.1-py3-none-any.whl (10.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page