Skip to main content

IoT Samba Client Library for Python

Project description

iot-samba-client

python version smbprotocol version

This package is a wrapper around the smbprotocol SDK for use in an IoT Platform.

Source code | Package PyPI

Table of Contents

Getting Started

This section provides basic examples with the iot-samba-client.

Prerequisites

  • Python 3.7 or later is required to use this package.

  • You must have a Samba Windows File Share server to use this package.

Basic Examples

  1. Install via pip:

    pip install iot-samba-client
    
  2. Import and say hello:

    from iot.samba.client import __version__
    
    
    print(f"hello world from iot-samba-client version: {__version__}")
    
  3. Basic usage:

    import tempfile
    
    from iot.samba.client import IoTSambaClient
    
    # instantiate client
    samba_client = IoTSambaClient(
        smb_server="windows-samba-s",
        smb_host="1.2.3.456",
        smb_port=445,
        smb_user="mySambaUserName",
        smb_pass="mySambaPass***"
    )
    
    # print info w/ repr
    print(f"{samba_client.__repr__()}")
    
    # download blob to tempfile
    temp_file = tempfile.NamedTemporaryFile()
    download_result = samba_client.download_file(
        share="MY_SAMBA_SHARE",
        path="path\\to\\blob\\parent\\dir",
        file="blob.txt",
        dest=temp_file.name,
    )
    if not download_result:
        print("unable to download file")
        temp_file.close()
        samba_client.disconnect()
        raise
    
    # upload tempfile to blob
    upload_result = samba_client.upload_file(
        share="MY_SAMBA_SHARE",
        path="path\\to\\new\\parent\\dir",
        file="newBlob.txt",
        source=temp_file.name,
    )
    if not upload_result:
        print("unable to upload file")
        temp_file.close()
        samba_client.disconnect()
        raise
    
    # clean-up local memory and disconnect from smb session
    temp_file.close()
    samba_client.disconnect()
    

API Documentation

IoTSambaClient Class

A wrapper client to interact with the smbprotocol at the share level.

This client provides operations to list, download, create and delete blobs within the share.

IoTSambaClient(smb_server, smb_host, smb_port, smb_user, smb_pass)

Parameters

  • smb_server str

    The name of the Samba Windows File Share server.

  • smb_host str

    The hostname or IP address of the Samba Windows File Share server.

  • smb_port int

    The port of the Samba Windows File Share server.

  • smb_user str

    The username to connect to the Samba Windows File Share server.

  • smb_pass Optional[str]

    The password to connect to the Samba Windows File Share server.

Contributing

Contributions and suggestions are welcomed. However, there is a level of responsibility placed on the contributor to follow best-practices, provide thorough testing, follow the branching strategy, use the pull request template, and maintain a positive and coachable attitude when receiving feedback or questions on your code.

Versioning

This repository adheres to Semantic Versioning. It will be maintained through the CHANGELOG.md - as is standard with PyPI packages It's important to note that you must maintain the version with your releases in iot/samba/client/_version.py, otherwise a new package version will fail to get published.

Deployment Process

  1. Linting, testing and building occurs when a pull request is made from a features/* branch to the master branch.

  2. Deployments to PyPI occur when an approved user triggers the GitHub Action. If the version has not been updated, this deployment will fail.

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

iot-samba-client-1.0.1.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

iot_samba_client-1.0.1-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file iot-samba-client-1.0.1.tar.gz.

File metadata

  • Download URL: iot-samba-client-1.0.1.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for iot-samba-client-1.0.1.tar.gz
Algorithm Hash digest
SHA256 5cdb4e547eb0a00677a4c2d4d2526c4caaf6689d130f74b6c978d8495b19abf5
MD5 ba0f456b01c13470b5ce76fc05944f57
BLAKE2b-256 036eea8c8ab3e4d1f410f6ad4dc6205184f4bbb2f07ad713bb64ba05c70c679d

See more details on using hashes here.

File details

Details for the file iot_samba_client-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for iot_samba_client-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1d1200e13657fd026eb4d14c5b58afb6f9432125ad941c6ee1aa9b7cbf25f183
MD5 d8511a7e9334323943a515b3fa48249d
BLAKE2b-256 6497d434ad96e619639399376ba0775a542603a4767148af53c12362cea907c6

See more details on using hashes here.

Supported by

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