mirror of
https://github.com/sartography/cr-connect-workflow.git
synced 2025-02-23 13:18:35 +00:00
Logging to troubleshoot API call
This commit is contained in:
parent
e22a9e7173
commit
8b6c8f9518
@ -3,6 +3,7 @@ from json import JSONDecodeError
|
|||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
import logging
|
||||||
|
|
||||||
from crc import app
|
from crc import app
|
||||||
from crc.api.common import ApiError
|
from crc.api.common import ApiError
|
||||||
@ -30,10 +31,13 @@ class ProtocolBuilderService(object):
|
|||||||
if not isinstance(user_id, str):
|
if not isinstance(user_id, str):
|
||||||
raise ApiError("protocol_builder_error", "This user id is invalid: " + str(user_id))
|
raise ApiError("protocol_builder_error", "This user id is invalid: " + str(user_id))
|
||||||
url = ProtocolBuilderService.STUDY_URL % user_id
|
url = ProtocolBuilderService.STUDY_URL % user_id
|
||||||
|
logging.info(f'get_studies: url: {url}')
|
||||||
response = requests.get(url)
|
response = requests.get(url)
|
||||||
if response.ok and response.text:
|
if response.ok and response.text:
|
||||||
|
logging.info(f'get_studies: response.text: {response.text}')
|
||||||
try:
|
try:
|
||||||
pb_studies = ProtocolBuilderStudySchema(many=True).loads(response.text)
|
pb_studies = ProtocolBuilderStudySchema(many=True).loads(response.text)
|
||||||
|
logging.info(f'get_studies: pb_studies: {pb_studies}')
|
||||||
return pb_studies
|
return pb_studies
|
||||||
except JSONDecodeError as err:
|
except JSONDecodeError as err:
|
||||||
raise ApiError("protocol_builder_error",
|
raise ApiError("protocol_builder_error",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user