MedicentreV3 Authentication Package
A reusable Python package for MedicentreV3 authentication and navigation.
Installation
From GitHub (Production)
# Install from GitHub (latest version)
pip install git+https://github.com/Hanmak-Technologies-Automation-Project/medicentrev3-authentication-package.git
# For development
pip install -e "git+https://github.com/Hanmak-Technologies-Automation-Project/medicentrev3-authentication-package.git#egg=medicentrev3-auth"
Local Development (Recommended for testing changes)
If you're developing or testing changes to this package, install it locally:
Option 1: Editable Install (Recommended)
# Navigate to the package directory
cd /path/to/medicentrev3-authentication-package
# Install in editable mode (-e flag)
pip install -e .
Option 2: Install from Local Path
# Install directly from local directory
pip install /path/to/medicentrev3-authentication-package
Option 3: Add to PYTHONPATH (For development only)
# Add the package directory to PYTHONPATH
export PYTHONPATH="/path/to/medicentrev3-authentication-package:$PYTHONPATH"
# Or add to your Python script
import sys
sys.path.insert(0, '/path/to/medicentrev3-authentication-package')
Verifying Installation
# Check if package is installed
python -c "import medicentrev3_auth; print('Version:', medicentrev3_auth.get_version())"
# Run the version checker
python /path/to/medicentrev3-authentication-package/check_version.py
Development and Testing
Quick Development Setup
# Run the development setup script
python setup_dev.py
Example Usage
# Run the example script to see how to use the package
python example_usage.py
Quick Start Template
Copy the quick_start_template.py file to your project and customize it:
cp /path/to/medicentrev3-authentication-package/quick_start_template.py ~/my_project/my_automation.py
Then modify it with your specific automation logic.
mkdir ~/my_automation_project
cd ~/my_automation_project
-
Install the package locally:
pip install -e /path/to/medicentrev3-authentication-package
-
Create environment file (
.env):MEDICENTRE_BASE_URL=https://medicentrev3.hanmak.co.ke MEDICENTRE_ACCESS_CODE=your_access_code MEDICENTRE_BRANCH=your_branch_name MEDICENTRE_USERNAME=your_username MEDICENTRE_PASSWORD=your_password
MEDICENTRE_BRANCHmust match a branch in the dropdown (case-insensitive). A partial name is accepted only if it matches exactly one branch; otherwise login fails and the available branches are logged. The package no longer falls back to the first branch.If the branch dropdown comes up empty after entering the access code, the page is reloaded and the access code re-entered. This is tunable:
auth = MedicentreAuth(login_attempts=3, branch_load_timeout=10) # defaults
-
Create your automation script (
automation.py):from medicentrev3_auth import MedicentreAuth # Create auth instance auth = MedicentreAuth(headless=False) # Setup and login if auth.setup_and_login(): print("Login successful!") # Navigate to procurement suppliers if auth.navigate_to('procurement', 'suppliers'): print("On suppliers page - ready for automation") # Your automation code here # Always logout auth.logout() else: print("Login failed")
-
Run your script:
python automation.py
Development Workflow
For ongoing development of the authentication package:
- Make changes to the package code
- Test locally using the development setup:
cd /path/to/medicentrev3-authentication-package python setup_dev.py
- Test in external project to ensure compatibility
- Update version when ready to release
- Push changes and inform users to update
Troubleshooting
Import errors:
# Make sure package is installed
pip install -e /path/to/medicentrev3-authentication-package
# Check installation
python -c "import medicentrev3_auth; print('OK')"
Login failures:
- Verify
.envfile exists and has correct values - Check network connectivity to MedicentreV3
- Ensure credentials are valid
- Try with
headless=Falseto see browser behavior
Permission issues:
- Ensure write permissions for logs/screenshots directories
- Check that Chrome/Chromium is installed for Selenium
Usage
from medicentrev3_auth import MedicentreAuth
# Create auth instance (loads .env by default)
auth = MedicentreAuth(headless=False)
# Or disable .env loading if you set env vars manually
auth = MedicentreAuth(load_env_file=False)
# Setup and login
if auth.setup_and_login():
# Navigate to a module panel
if auth.navigate_to('procurement', 'suppliers'):
# Your module-specific automation here
pass
# Always logout when done
auth.logout()
Updating the Package
When updates are available, users should upgrade using:
# Upgrade to latest version
pip install --upgrade git+https://github.com/Hanmak-Technologies-Automation-Project/medicentrev3-authentication-package.git
# Or reinstall (force latest)
pip install --force-reinstall git+https://github.com/Hanmak-Technologies-Automation-Project/medicentrev3-authentication-package.git
Important: Always use --upgrade or --force-reinstall when updating from GitHub to ensure you get the latest changes.
Checking Your Version
You can check your current package version and see if updates are available:
# Run the version checker script
python check_version.py
# Or check programmatically in Python
python -c "import medicentrev3_auth; print('Version:', medicentrev3_auth.get_version())"
Version History
v1.1.0
- Added version checking utilities (
get_version(),check_for_updates()) - Improved documentation and update instructions
- Enhanced package metadata
- Modernized WebDriver setup: Now uses Selenium Manager (Selenium 4.11+) instead of webdriver-manager for better reliability and fewer dependencies
v1.0.0
- Initial release
- Basic authentication and navigation functionality
- Support for all major MedicentreV3 modules
Metadata
Release files for medicentrev3-auth 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| medicentrev3_auth-1.2.0.tar.gz | 15.0 kB | Without provenance | Details for medicentrev3_auth-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| medicentrev3_auth-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for medicentrev3_auth-1.2.0-py3-none-any.whl |
Total release size: 28.2 kB
Release files / medicentrev3_auth-1.2.0.tar.gz
| Download URL | medicentrev3_auth-1.2.0.tar.gz |
|---|---|
| Size | 15.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
72c56b3bded75b5a7a16d44b0f3b402b6bccaffdbe37a7e3193545cd07c6ae06
|
|
BLAKE2b-256 checksum How to use checksums |
f77909bccceda77751168d3336aea6e11e8f0223f64a4ba490269978435cddcf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / medicentrev3_auth-1.2.0-py3-none-any.whl
| Download URL | medicentrev3_auth-1.2.0-py3-none-any.whl |
|---|---|
| Size | 13.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0c1892e41a7d6a5671b14b50aaf38a703ed45ed28fac6bcac6113067cdf3c953
|
|
BLAKE2b-256 checksum How to use checksums |
3de57eee13ec70f5bb662aa843a91aeb952ad6618c5ef5dbd169fb38ca47e6df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Security for medicentrev3-auth 1.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.