Setting Up the Clore Developer Toolkit
Prerequisites
Before diving in, ensure that you have the following:
A system running Linux, macOS, or Windows.
Python 3.8 or above (recommended for running CLI tools and scripts).
Access to Clore’s API (an API key, available in your Clore developer account).
Basic knowledge of the command line.
Step 1: Installing the Toolkit
To begin, download and install the Clore Developer Toolkit. Use the following commands to install it directly from Clore’s GitHub repository.
If you’re using a virtual environment, activate it first to keep the dependencies isolated:
Step 2: Configuration and Authentication
Once installed, the next step is configuring the toolkit with your Clore API key. This key is essential for authentication.
Generating an API Key
Navigate to “API Keys” and click on “Generate New Key.”
Save the key securely; you’ll need it in the configuration step.
Configuring the Toolkit
Create a .env
file in the clore-dev-toolkit
directory for secure storage of your API key and other configuration settings.
Load this configuration in the toolkit using a Python script:
Step 3: Verifying API Connection
With the toolkit installed and configured, verify the API connection by making a test request. Here’s an example Python script to fetch account information.
Run this script to confirm that the API key is correctly configured and that your system can connect to Clore’s API. A successful output will show your account details.
Step 4: Running Sample Scripts
The toolkit includes sample scripts to help you get started quickly. To run a sample script, execute the following:
Example Code from sample_rent_server.py
Here’s a portion of the script to rent a server:
This example script demonstrates the basics of API interaction for renting servers and can be expanded for custom configurations and error handling.
Step 5: Customizing the Toolkit
For more advanced users, the toolkit can be customized to add additional functionalities or tailored requests. Consider adding modules or helper functions for tasks such as bulk server management or real-time monitoring.
Adding Helper Functions
Create a helpers.py
file to store utility functions that streamline repetitive tasks. For instance:
Now, you can use api_request()
in other scripts for a cleaner code structure:
Final Step: Testing and Troubleshooting
With everything set up, perform a full test of your toolkit installation by running each script in the examples/
directory. Monitor for any errors, and consult the toolkit’s logs if needed.
Common Troubleshooting Tips
Connection Issues: Verify network access and API endpoint availability.
Authentication Errors: Double-check the API key configuration.
Dependency Issues: Reinstall dependencies with
pip install -r requirements.txt
in case of errors.
By following these steps, you should now have a fully operational Clore Developer Toolkit setup, enabling you to explore more advanced features and start building your Clore-based applications.
Last updated