Created
November 13, 2019 02:19
-
-
Save paul121/011a5d56df1693b7f4a0dd353af9d4b0 to your computer and use it in GitHub Desktop.
Looping through log results
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
farm = farmOS(hostname=hostname, username=username, password=password) | |
test_log_done = {'name':'This is log is done', 'type':'farm_observation','done': 1} | |
test_log_not_done = {'name':'This is log is NOT done', 'type':'farm_observation', 'done': 0} | |
farm.log.send(test_log_done) | |
farm.log.send(test_log_not_done) | |
all_logs = farm.log.get() | |
for log in all_logs['list']: | |
print("Name: " + log['name']) | |
status = "Not Done" | |
if 'done' in log and log['done'] is '1': | |
staus = "Done!!!" | |
print("Status: " + status) | |
''' | |
OUTPUT>>> | |
Name: Harvest a ton of beans | |
Status: Done!!! | |
Name: Test log | |
Status: Done!!! | |
Name: This is log is done | |
Status: Done!!! | |
Name: This is log is NOT done | |
Status: Not Done | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment