Skip to main content

villaAuthSdk

interact with villa authentication backend

Install

pip install villaAuthSdk

How to use

create an auth object

from villaAuthSdk.auth import AuthSdk
from nicHelper.dictUtil import printDict
sdk=AuthSdk(user=None,pw=None,region='ap-southeast-1')
## user and pw here are the aws key/secret for your client

Create cashier

sdk.createCashier({
  'user': 'nic1',
  'phone': '+66816684442',
  'pw': '12345678',
  'name': 'nic',
  'cashierCode': '001',
  'email': 'test@gmail.com'
})
{'success': True,
 'user': 'nic1',
 'phone': '+66816684442',
 'pw': '12345678',
 'name': 'nic',
 'cashierCode': '001',
 'email': 'test@gmail.com',
 'body': '{"Username":"nic1","UserAttributes":{"sub":"f5aa60ba-0f65-45f3-b8f7-2a064e7e5311","email_verified":"false","name":"nic","custom:cashierCode":"001","phone_number_verified":"true","phone_number":"+66816684442","email":"test@gmail.com"},"UserCreateDate":1606995525.734,"UserLastModifiedDate":1606995525.988,"Enabled":true,"UserStatus":"CONFIRMED","ResponseMetadata":{"RequestId":"6b2010b5-aabc-4d36-8e3e-0234da56f3ab","HTTPStatusCode":200,"HTTPHeaders":{"date":"Thu, 03 Dec 2020 11:38:46 GMT","content-type":"application\\/x-amz-json-1.1","content-length":"467","connection":"keep-alive","x-amzn-requestid":"6b2010b5-aabc-4d36-8e3e-0234da56f3ab"},"RetryAttempts":0}}',
 'statusCode': 200,
 'headers': {'Access-Control-Allow-Headers': '*',
  'Access-Control-Allow-Origin': '*',
  'Access-Control-Allow-Methods': '*'}}

login

result = sdk.auth(user='nic1',pw='12345678')
printDict(result)
AccessKeyId : ASIAVX4Z5T
SecretKey : zTt7RyFFji
SessionToken : IQoJb3JpZ2
Expiration : 1606999129.0
AccessToken : eyJraWQiOi
ExpiresIn : 3600
TokenType : Bearer
RefreshToken : eyJjdHkiOi
IdToken : eyJraWQiOi
NewDeviceMetadata
 DeviceKey : ap-southea
 DeviceGroupKey : -lt0cpemm
userInfo
 Username : nic1
 UserCreateDate : 1606995525.734
 UserLastModifiedDate : 1606995525.988
 Enabled : True
 UserStatus : CONFIRMED
 ResponseMetadata
  RequestId : 44425d05-8
  HTTPStatusCode : 200
  HTTPHeaders
   date : Thu, 03 De
   content-type : applicatio
   content-length : 467
   connection : keep-alive
   x-amzn-requestid : 44425d05-8
  RetryAttempts : 0
kwUserAttrib
 sub : f5aa60ba-0
 email_verified : false
 name : nic
 custom:cashierCode : 001
 phone_number_verified : true
 phone_number : +668166844
 email : test@gmail

Confirm

confirm phone/email

result=sdk.confirm(user='nic1', code= '123')
printDict(result)
error
 pickledb64string : gASVTQUAAA
 error : confirmati

Get Profile

result=sdk.getProfile('nic1')
printDict(result)
Username : nic1
UserAttributes
 sub : f5aa60ba-0
 email_verified : false
 name : nic
 custom:cashierCode : 001
 phone_number_verified : true
 phone_number : +668166844
 email : test@gmail
UserCreateDate : 1606995525.734
UserLastModifiedDate : 1606995525.988
Enabled : True
UserStatus : CONFIRMED
ResponseMetadata
 RequestId : 85a734ac-2
 HTTPStatusCode : 200
 HTTPHeaders
  date : Thu, 03 De
  content-type : applicatio
  content-length : 467
  connection : keep-alive
  x-amzn-requestid : 85a734ac-2
 RetryAttempts : 0

update Profile

result = sdk.updateProfile(
  user= 'nic1',
  attributes= {
    'custom:cashierCode': '1234'
  })
printDict(result)
Username : nic1
UserAttributes
 sub : f5aa60ba-0
 email_verified : false
 name : nic
 custom:cashierCode : 1234
 phone_number_verified : true
 phone_number : +668166844
 email : test@gmail
UserCreateDate : 1606995525.734
UserLastModifiedDate : 1606995533.461
Enabled : True
UserStatus : CONFIRMED
ResponseMetadata
 RequestId : ec6ffad2-1
 HTTPStatusCode : 200
 HTTPHeaders
  date : Thu, 03 De
  content-type : applicatio
  content-length : 468
  connection : keep-alive
  x-amzn-requestid : ec6ffad2-1
 RetryAttempts : 0

set password

sdk.setPassword(user='nic1',pw='12345678')
{'ResponseMetadata': {'RequestId': 'e878f2d6-d1de-487c-8a0a-484072b82309',
  'HTTPStatusCode': 200,
  'HTTPHeaders': {'date': 'Thu, 03 Dec 2020 11:38:54 GMT',
   'content-type': 'application/x-amz-json-1.1',
   'content-length': '2',
   'connection': 'keep-alive',
   'x-amzn-requestid': 'e878f2d6-d1de-487c-8a0a-484072b82309'},
  'RetryAttempts': 0}}

Unauth

get unauthenticated credentials

result = sdk.unauth()
printDict(result)
AccessKeyId : ASIAVX4Z5T
SecretKey : UbsJ2mlM3z
SessionToken : IQoJb3JpZ2
Expiration : 1606999136.0

DeleteUser

result = sdk.deleteUser(user='nic1')
printDict(result)
ResponseMetadata
 RequestId : 7e3fc4ac-5
 HTTPStatusCode : 200
 HTTPHeaders
  date : Thu, 03 De
  content-type : applicatio
  content-length : 0
  connection : keep-alive
  x-amzn-requestid : 7e3fc4ac-5
 RetryAttempts : 0

Metadata

Release files for villaAuthSdk 0.0.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for villaAuthSdk 0.0.12
File Size Uploaded Provenance
villaAuthSdk-0.0.12.tar.gz 12.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for villaAuthSdk 0.0.12
File Interpreter ABI Platform
villaAuthSdk-0.0.12-py3-none-any.whl Python 3 none any Details

Total release size: 21.6 kB

Release files / villaAuthSdk-0.0.12.tar.gz

Download URL villaAuthSdk-0.0.12.tar.gz
Size 12.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6a166c83660a618431fc6cb2f492f1671ef5d4b3052fcec1009d80d606a10bd9
BLAKE2b-256 checksum
How to use checksums
70df34cdc2e2ece813138e1300a88bad74292b17ca9fd3719903898974928e8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20201009 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.6

Release files / villaAuthSdk-0.0.12-py3-none-any.whl

Download URL villaAuthSdk-0.0.12-py3-none-any.whl
Size 9.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df681e8c8985b1e87ca67c9fc87b9d213858f7f435dbc679696c5adcdeebe195
BLAKE2b-256 checksum
How to use checksums
a7b4e08dac1fc96acecb535b9e5b915803e5d61994d9e4bb8f1ee9ee60ca2a96
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0.post20201009 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.6

Security for villaAuthSdk 0.0.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page