https://github.com/laspavel/foreman-api
Simple Python Foreman api client
https://github.com/laspavel/foreman-api
foreman foreman-api python3 rest-api rest-api-client
Last synced: 20 days ago
JSON representation
Simple Python Foreman api client
- Host: GitHub
- URL: https://github.com/laspavel/foreman-api
- Owner: laspavel
- License: mit
- Created: 2023-06-06T17:59:51.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2025-04-12T16:14:25.000Z (about 1 year ago)
- Last Synced: 2025-04-12T17:27:46.798Z (about 1 year ago)
- Topics: foreman, foreman-api, python3, rest-api, rest-api-client
- Language: Python
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Foreman API – Python Client for Foreman
Foreman API is a lightweight Python client designed to interact with the Foreman RESTful API. It simplifies the process of automating tasks such as provisioning, configuration, and monitoring of servers managed by Foreman.
## 📌 Features
* Simple and intuitive interface for making API requests
* Support for GET, POST, PUT, and DELETE HTTP methods
* Handles authentication seamlessly
* Flexible parameter handling for various API endpoints
## ⚙️ Requirements
* Python 3.8 or higher
* Access to a Foreman instance with API credentials
## 🚀 Installation
Clone the repository and include ForemanApi.py in your project:
```bash
git clone https://github.com/laspavel/foreman-api.git
```
Alternatively, you can copy the ForemanApi.py file directly into your project directory.
## 🧪 Usage Example
Here's a basic example of how to use the Foreman API client:
```python
import ForemanApi
# Initialize the Foreman API client
rapi = ForemanApi.ForemanAPI('https://foreman.example.com/api/', 'apiuser', 'apipassword')
# Retrieve information about a specific host
host_info = rapi.api_request(api_type='get', api_method='hosts/1')
# Alternatively, using the shorthand method
# host_info = rapi.get.hosts(id=1)
print(host_info)
```
For more examples, refer to the example.py file included in the repository.
## 📄 License
MIT License.
## 🤝 Contributions
Suggestions and improvements are welcome! Feel free to open an issue or submit a pull request.
## 📬 Contact
Author: [laspavel](https://github.com/laspavel)
Feel free to reach out with questions or ideas.
---