# !pip install farmOS==1.0.0b3
from farmOS import farmOS
hostname="http://localhost"
client = farmOS(hostname, client_id="farm", scope="farm_manager")
current_token = client.authorize()
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
import asyncio | |
from collections import ChainMap | |
import csv | |
import time | |
from farmOS import AsyncFarmClient | |
from httpx_auth import OAuth2ResourceOwnerPasswordCredentials | |
from httpx import Limits | |
hostname = "https://rothamstedfarm.farmos.net" |
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
{ | |
"title": "Post title", | |
"comment": "Post description", | |
"files": [ | |
{ | |
"iri": "regen:1111.png", | |
"name": "Image file name", | |
"description": "Image description", | |
"credit": "Paul", | |
"location": {"wkt": "POINT(1 2)"} |
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
# Platform.sh Project Initialization Template | |
# | |
# This file defines settings and workflow modifications that allow a git | |
# repository to be deployed to Platform.sh and its white-label partners. A | |
# project template can be a fully functioning ready-made application or a | |
# quick-start point for custom development work. | |
# | |
# It contains elements that affect the behaviour upon the initialisation of | |
# a new project (for example minimal plan sizes) as well as elements that | |
# allow Platform.sh to present it in a user interface (such as the description |
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
<?php | |
use Drupal\asset\Entity\Asset; | |
use Drupal\log\Entity\Log; | |
// Debug flag, leave TRUE to not perform any actions. | |
$debug = TRUE; | |
#$debug = FALSE; | |
// Hosts to to not run this script on. |
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
<?php | |
use Drupal\asset\Entity\Asset; | |
use Drupal\log\Entity\Log; | |
// Debug flag, leave TRUE to not perform any actions. | |
$debug = TRUE; | |
#$debug = FALSE; | |
// Only query assets created by this username. |
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
import os | |
import csv | |
import argparse | |
import logging | |
from datetime import datetime | |
from time import time | |
from farmOS import farmOS | |
### Setup |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
// Import client factory method for node. | |
const {client} = require('farmos/dist/cjs/farmOS'); | |
// Create a custom auth method to set the api-key header and farm_id query param. | |
const apiKeyAuth = (request, authOpts = {}) => { | |
request.interceptors.request.use( | |
config => { | |
return { | |
...config, | |
headers: { |
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
import os | |
from requests.sessions import Session | |
from farmOS.client_2 import ResourceBase | |
# Allow testing via http. | |
os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1" | |
class AggregatorSession(Session): |
NewerOlder