tested to work for most entities NEXT: add logs property to asset

This commit is contained in:
2024-11-01 16:52:40 +01:00
parent ae1156bd6c
commit 772acff4e8
7 changed files with 84 additions and 57 deletions

View File

@@ -2,10 +2,8 @@ import requests
from oauthlib.oauth2 import BackendApplicationClient
from requests_oauthlib import OAuth2Session, OAuth2
import jsonapi_requests
from orm.log import *
from orm.asset import *
from orm.quantity import *
from orm.taxonomy import *
from orm.my_meta import MyMeta
# constants:
root_url = 'https://farmos.wagframe.duckdns.org/'
@@ -14,9 +12,6 @@ token_url = root_url + 'oauth/token/'
client_id = 'neofarm'
client_secret = 'Wk&%g#d8lYFUDrU7k7k%5ZS$V@hHauBq'
api_path_separator = '/'
api_type_spatrator = '--'
def init_api():
client = BackendApplicationClient(client_id=client_id)
oauth_session = OAuth2Session(client=client)
@@ -36,7 +31,9 @@ def init_api():
return api
api = init_api()
Log.Meta.set_api(api)
Asset.Meta.set_api(api)
Quantity.Meta.set_api(api)
Taxonomy.Meta.set_api(api)
MyMeta.set_api(api)
# these have to be defined after MyMeta.api is set for the correct value to be inherited
from orm.log import *
from orm.asset import *
from orm.quantity import *
from orm.taxonomy import *