A simple sample package
Project description
Log-hub Python API library
Introduction
The pyloghub
package provides convinient access to various Log-hub API services for Supply Chain Visualization, Network Design Optimization, and Transport Optimization.
Prerequisites
- Python 3.10 or later recommended
- Pip (Python package manager)
- Log-hub API key
- Supply Chain APPS PRO subscription
Installation
Setting Up Python Environment
Recommended Python Version
Python 3.10 or later is recommended for optimal performance and compatibility.
Optional: Setting Up a Virtual Environment
A virtual environment allows you to manage Python packages for different projects separately.
-
Create a Virtual Environment:
- Windows:
python -m venv loghub_env
- macOS/Linux:
python3 -m venv loghub_env
- Windows:
-
Activate the Virtual Environment:
- Windows:
.\loghub_env\Scripts\activate
- macOS/Linux:
source loghub_env/bin/activate
Deactivate with
deactivate
when done. - Windows:
Installing pyloghub
Package
Within the environment, install the package using:
pip install pyloghub
Configuration
Obtaining an API Key
- Sign up or log in at Log-hub Account Integration.
- Obtain your API key.
Setting Up Your Environment
Securely store your API key for use in your Python scripts or as an environment variable.
Usage
Sample Code: Reverse Distance Calculation
This example demonstrates using the Reverse Distance Calculation feature:
-
Import Functions:
from pyloghub.distance_calculation import reverse_distance_calculation, reverse_distance_calculation_sample_data
-
Load Sample Data:
sample_data = reverse_distance_calculation_sample_data() geocode_data_df = sample_data['geocode_data'] parameters = sample_data['parameters']
-
Perform Calculation:
reverse_distance_result_df = reverse_distance_calculation(geocode_data_df, parameters, 'YOUR_API_KEY')
Replace
'YOUR_API_KEY'
with your actual Log-hub API key. -
View Results:
print(reverse_distance_result_df)
Support
For additional support, questions, or feedback, please reach out to us via email:
- Email Support: support@log-hub.com
Alternatively, for more information and resources, visit Log-hub API Documentation.
License
Distributed under the MIT License.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.