A Python library for interacting with farmOS over API.
Project description
farmOS.py
farmOS.py is a Python library for interacting with farmOS over API.
For more information on farmOS, visit farmOS.org.
USAGE
import farmOS
hostname = 'myfarm.farmos.net'
username = 'My Name'
password = 'mYPa$$w0rd'
farm = farmOS.farmOS(hostname, username, password)
success = farm.authenticate()
# Get farm info
info = farm.info()
# Get all logs
logs = farm.log.get()
# Get harvest logs
harvests = farm.log.get({
'type':'farm_harvest'
})
# Get log number 37
log = farm.log.get(37)
# Get all assets
assets = farm.asset.get()
# Get all animal assets
animals = farm.asset.get({
'type':'animal'
})
# Get all areas
areas = farm.area.get()
# Get field areas
fields = farm.area.get({
'area_type':'field'
})
# Get all terms
terms = farm.term.get()
# Get all terms from farm_crops vocabulary
crops = farm.term.get('farm_crops')
You can configure how farmOS
logs are displayed with the following:
import logging
# Required to init a config on the ROOT logger, that all other inherit from
logging.basicConfig()
# Configure all loggers under farmOS (farmOS.client, famrOS.session) to desired level
logging.getLogger("farmOS").setLevel(logging.DEBUG)
# Hide debug logging from the farmOS.session module
logging.getLogger("farmOS.session").setLevel(logging.WARNING)
More info on logging in Python here.
TESTING
Configure credentials for the farmOS instance used to test in
tests/test_credentials.py
Automated tests are run with pytest
python setup.py test
MAINTAINERS
- Paul Weidner (paul121) - https://github.com/paul121
- Michael Stenta (m.stenta) - https://github.com/mstenta
This project has been sponsored by:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
farmOS-0.1.5.tar.gz
(12.9 kB
view details)
Built Distribution
farmOS-0.1.5-py3-none-any.whl
(26.2 kB
view details)
File details
Details for the file farmOS-0.1.5.tar.gz
.
File metadata
- Download URL: farmOS-0.1.5.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 638e593a501206ae6699019a5ead18a5c67f7af188e6479c5f99fc6b8c66c2ab |
|
MD5 | 3c35064e841b065bad018593455dc411 |
|
BLAKE2b-256 | 22a4b76cdc693eb6de910fa7683eb857022c9fd3b9a8cd2fe8f7099fd8e3d9fd |
File details
Details for the file farmOS-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: farmOS-0.1.5-py3-none-any.whl
- Upload date:
- Size: 26.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 615c876a45950d4762d42877325083bd090490a5a0b586c6335d26ecd9a81025 |
|
MD5 | a9951f50f4c34687a431f71ec721a787 |
|
BLAKE2b-256 | f666a171ae526d60a4f095fbbdb594bd4190476133ba35011f2bbaaab178d504 |