Skip to content

Commit

Permalink
Load version specific info. #103
Browse files Browse the repository at this point in the history
  • Loading branch information
paul121 committed Mar 4, 2021
1 parent 871e33f commit a918696
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion backend/app/app/routers/api_v2/endpoints/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,13 @@ def authorize_farm(
try:
farm_client = get_farm_client(db=db, farm=farm)

info = farm_client.info()
response = farm_client.info()
# Set the info depending on v1 or v2.
# v2 provides info under the meta.farm key.
if "meta" in response:
info = response["meta"]["farm"]
else:
info = response

crud.farm.update_info(db, farm=farm, info=info)
except Exception as e:
Expand Down

0 comments on commit a918696

Please sign in to comment.