A description of your project
Project description
villaInventorySdk
Install
pip install villaInventorySdk
How to use
Uploading a large amount of data
sample input
from villaInventorySdk.inventory import InventorySdk
from random import randrange
import boto3, time, json
from dataclasses import dataclass
from dataclasses_json import dataclass_json
from datetime import datetime
import pandas as pd
from nicHelper.dictUtil import printDict
sampleInput = [
{ 'cprcode': '0000009', 'brcode': '1000', 'ib_cf_qty': '50', 'new_ib_vs_stock_cv': '27' },
{ 'cprcode': '0000004', 'brcode': '1000', 'ib_cf_qty': '35', 'new_ib_vs_stock_cv': '33' },
{ 'cprcode': '0000003', 'brcode': '1003', 'ib_cf_qty': '36', 'new_ib_vs_stock_cv': '33' }
]
df = pd.DataFrame(sampleInput)
df
<style scoped>
.dataframe tbody tr th:only-of-type {
vertical-align: middle;
}
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
cprcode | brcode | ib_cf_qty | new_ib_vs_stock_cv | |
---|---|---|---|---|
0 | 0000009 | 1000 | 50 | 27 |
1 | 0000004 | 1000 | 35 | 33 |
2 | 0000003 | 1003 | 36 | 33 |
Upload data
init sdk
%%time
USER=None
PW = None
sdk = InventorySdk(user=USER, pw=PW, branchName = branch)
CPU times: user 33.2 ms, sys: 6.92 ms, total: 40.1 ms
Wall time: 39.2 ms
Update inventory
%%time
key = 'test'
r = sdk.uploadDf(df, key = key)
if r.status_code >= 400: raise Exception(r.json())
sdk.ingestData(key = key)
signed url is
url : https://in
fields
key : test
AWSAccessKeyId : ASIAVX4Z5T
x-amz-security-token : IQoJb3JpZ2
policy : eyJleHBpcm
signature : bx6qL+1QUg
CPU times: user 61 ms, sys: 0 ns, total: 61 ms
Wall time: 520 ms
{'body': '{}',
'statusCode': 200,
'headers': {'Access-Control-Allow-Headers': '*',
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': '*'}}
Query single product
%%time
sdk.querySingleProduct2(cprcode='1234')
succesfully get url, returning pandas
CPU times: user 19.8 ms, sys: 0 ns, total: 19.8 ms
Wall time: 332 ms
<style scoped>
.dataframe tbody tr th:only-of-type {
vertical-align: middle;
}
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
cprcode | brcode | ib_cf_qty | new_ib_vs_stock_cv | |
---|---|---|---|---|
0 | 1234 | test | 123 | 123 |
Query Branch
%%time
sdk.branchQuery(brcode='1000', cprcodes = ['0000009'])
CPU times: user 16.5 ms, sys: 70 µs, total: 16.6 ms
Wall time: 225 ms
<style scoped>
.dataframe tbody tr th:only-of-type {
vertical-align: middle;
}
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
cprcode | brcode | ib_cf_qty | new_ib_vs_stock_cv | |
---|---|---|---|---|
0 | 0000009 | 1000 | 50 | 27 |
Query All
%%time
sdk.queryAll2()
succesfully get url, returning pandas
CPU times: user 13.6 ms, sys: 3.08 ms, total: 16.7 ms
Wall time: 323 ms
<style scoped>
.dataframe tbody tr th:only-of-type {
vertical-align: middle;
}
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
cprcode | brcode | ib_cf_qty | new_ib_vs_stock_cv | |
---|---|---|---|---|
0 | 1234 | test | 123 | 123 |
1 | 12345 | test | 345 | 345 |
2 | 0000009 | 1000 | 50 | 27 |
3 | 0000004 | 1000 | 35 | 33 |
4 | 0000003 | 1003 | 36 | 33 |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
villaInventorySdk-0.1.1.tar.gz
(15.1 kB
view hashes)
Built Distribution
Close
Hashes for villaInventorySdk-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 344314b1f67f82ec5e6ed19dd6cf6fa1963de8599aefc69b49ed66e20f7b4e43 |
|
MD5 | 7b97c95c19593ed2f274aedee30ab529 |
|
BLAKE2b-256 | 9b6f3a2f2fa767799cbb7dffb2902c86dc2aa699dea6a35734535ae8891e6323 |