-
Print
-
DarkLight
-
PDF
SDK Reference
-
Print
-
DarkLight
-
PDF
SDK Reference - Repositories, Entities & Tutorials
The Dataloop Python dtlpy package enables a Python connection to Dataloop's environment.
Installation
Install Python
Install the dtlpy package
Install the plugin using pip, write the following command and press ENTER:
pip install dtlpy
Alternatively, install pip from the source by cloning the GitHub repo, then run the following command:
python setup.py install
You can use pip to install the Virtualenv tool, which lets you create an isolated Python environment for your project.
pip install virtualenv
Set your dtlpy logging level to be displayed. The default value is a warning.
To understand more about Python logging levels please click here.
#import the dtlpy package to your python environment
import dtlpy as dl
#All supported levels
dl.VERBOSE_LOGGING_LEVEL_DEBUG
dl.VERBOSE_LOGGING_LEVEL_INFO
dl.VERBOSE_LOGGING_LEVEL_WARNING
dl.VERBOSE_LOGGING_LEVEL_ERROR
dl.VERBOSE_LOGGING_LEVEL_CRITICAL
#For example, set INFO level :
dl.verbose.logging_level = dl.VERBOSE_LOGGING_LEVEL_INFO
Login to the platform
To log in, type the command below :
Once your browser opens the Login screen, type the credentials below or login with Google.
User: yours@example.com
Password: [your password]
Please wait for the "Login Successful" tab to appear, then close the tab.
M2M Login
Long-running SDK jobs require API authentication.
M2M Login is recommended when you want to
- run commands on the platform without an ongoing internet connection
- run API commands directly from an external system to Dataloop
Log In Via SDK
1. Create a bot user with a unique name
Create a bot user with developer permissions to be used for every M2M login.
You only need to perform this step if this is your first time logging in.
import dtlpy as dl
dl.login() # use browser login to create the bot
project = dl.projects.get(project_name='myProject') # get your project
myBot = project.bots.create(name='my-unique-name', return_credentials=True)
print("the bot email is "+myBot.email)
print("the bot password is "+myBot.password)
2. Log in to the SDK with your new bot:
import dtlpy as dl
# Login to Dataloop platform
dl.login_m2m(email=email, password=password)
Log In Via SDK
1. Register into the system using a password method.
- You can sign up with your personal username and password.
- You will need to log in to the Dataloop platform once via the browser, using a password method and not with Google.
2. Verify the user via email.
3. Log in to the SDK:
import dtlpy as dl
# Login to Dataloop platform
dl.login_m2m(email="my_email_address", password="my_password")
Logout
Use this script when you wish to log out of the platform:
dl.logout()
Upgrade the dtlpy Package
If you wish to upgrade an already installed dtlpy:
- Refer to the following page to see the dtlpy latest version and version history.
- Explore our release notes to see the changes for each version.
pip install dtlpy --upgrade