Package: uplink-python
uplink-python bindingDeveloped using v1.2.2 storj/uplink-cAPI documentation and tutorialInitial Set-up (Important)NOTE: for GolangMake sure yourPATHincludes the$GOPATH/bindirectory, so that your commands can be easily usedRefer: Install the Go Tools:export PATH=$PATH:$GOPATH/binDepending on your operating system, you will need to install:On UnixA proper C/C++ compiler toolchain, likeGCCOn macOSXcode: You also need to install the XCode Command Line Tools by running xcode-select --install. Alternatively, if you already have the full Xcode installed, you can find them under the menu Xcode -> Open Developer Tool -> More Developer Tools.... This step will install clang, clang++, and make.On WindowsInstall Visual C++ Build Environment:Visual Studio Build Tools(using "Visual C++ build tools" workload) orVisual Studio 2017 Community(using the "Desktop development with C++" workload)Make sure you have access tosite-packagesfolder inside the directory where Python is installed. To do this navigate to the directory where Python is installed, if you get an error "Permission Denied", follow the instruction in the message box and allow access usingsecurity tab.Binding Set-upPlease ensure you have Python 3.x andpipinstalled on your system. If you have Python version 3.4 or later, pip is included by default. uplink-python does not support Python 2.x.$ python get-pip.pyOption 1Installuplink-pythonpython package with--no-cache-dirtag if re-installing or upgrading from the previous version, otherwise, the tag can be ignored (using Terminal/Powershell/CMD asAdministrator):$ pip install --no-cache-dir uplink-pythonNote: IfAdministratorprivilege is not granted to the terminal/cmd, the libuplinkc.so build process may fail.Option 2Follow these steps to set-up binding manually or iflibuplinkc.sofails to build using Option 1.Installuplink-pythonpython package (using Terminal/Powershell/CMD) if not already done inOption 1$ pip install uplink-pythonClonestorj-uplink-cpackage to any location of your choice, using cmd/terminal navigate toPREFERED_DIR_PATHand run:$ git clone -b v1.2.2 https://github.com/storj/uplink-cAfter cloning the package, navigate to thePREFERED_DIR_PATH/uplink-cfolder.$ cd uplink-cCreate '.so' file atPREFERED_DIR_PATH/uplink-cfolder, by using following command:$ go build -o libuplinkc.so -buildmode=c-sharedCopy createdlibuplinkc.sofile into the folder, where Python package was installed (by default it is python3.X->site-packages->uplink_python)Project Set-upTo include uplink in your project, import the library, by using the following command:from uplink_python.uplink import UplinkCreate an object ofUplinkclass to access all the functions of the library. Please refer to the samplehello_storj.pyfile, for example.variable_name = Uplink()To use various parameters such as ListBucketsOptions, ListObjectsOptions, Permissions, etc you would require to import them first from module_classes i.e. uplink_python.module_classes.from uplink_python.module_classes import DownloadOptions, PermissionTo use various user-defined Storj Exceptions such as InternalError, BucketNotFoundError, etc you would require to import them first from errors i.e. uplink_python.errors.from uplink_python.errors import InternalError, BucketNotFoundErrorSample Hello Storj!Filehello_storj.pycan be found in the folder where the Python package was installed.The samplehello_storj.pycode calls theuplink.pyfile and imports theUplinkbinding class to do the following:list all buckets in a Storj projectcreate a new bucket (if it does not exist) within the desired Storj projectwrite a file from local computer to the Storj bucketread back the object from the Storj bucket to the local system for verificationlist all objects in a bucketdelete bucket from a Storj projectcreate shareable Access with permissions and shared prefix.list all buckets and objects with permission to shareable access.Run Unit Test Cases on LocalDirectory with unit test casestestcan be found in the uplink-python repository.To run the test cases on a local system, you need to perform the following steps:clone the repo so that you have the test folder on your local system.directory_on_local
  â””â”€â”€ test
      â””â”€â”€ __init__.py
      â””â”€â”€ test_data
      â””â”€â”€ test_cases.pyAdd a test file parallel to the tests folder, addAPI Keyin the file, and name it assecret.txt. The directory structure would be something like this now:directory_on_local
  â””â”€â”€ secret.txt
  â””â”€â”€ test
      â””â”€â”€ __init__.py
      â””â”€â”€ test_data
      â””â”€â”€ test_cases.pyNavigate to the folder, heredirectory_on_localand use the following command to run through all the tests.$ python3 -m unittest test/test_cases.py -vDocumentationFor more information on function definations and diagrams, check out theDetailor jump to:Uplink-Python Binding FunctionsFlow Diagramlibuplink Documentation