Skip to content

Instantly share code, notes, and snippets.

@paul121
Created November 13, 2019 02:19
Show Gist options
  • Save paul121/011a5d56df1693b7f4a0dd353af9d4b0 to your computer and use it in GitHub Desktop.
Save paul121/011a5d56df1693b7f4a0dd353af9d4b0 to your computer and use it in GitHub Desktop.
Looping through log results
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