Skip to content

Commit

Permalink
rm logging for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
jmargutt committed Mar 21, 2024
1 parent 4b823b9 commit ab30d0f
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,12 @@ def get_attachment_dict(kobo_data, kobotoken=None, koboasset=None):
attachments, attachments_list = {}, []
if kobotoken and koboasset and '_id' in kobo_data.keys():
sleep(5)
logging.info("trying new attachment strategy")
headers = {'Authorization': f'Token {kobotoken}'}
URL = f"https://kobo.ifrc.org/api/v2/assets/{koboasset}/data/{kobo_data['_id']}/?format=json"
data_request = requests.get(URL, headers=headers)
data = data_request.json()
logging.info(f"data retrieved: {data}")
if '_attachments' in data.keys():
attachments_list = data['_attachments']
logging.info(f"attachments_list: {attachments_list}")
else:
logging.info("missing something")
if len(attachments_list) == 0:
if '_attachments' in kobo_data.keys():
attachments_list = kobo_data['_attachments']
Expand All @@ -136,7 +131,6 @@ def get_attachment_dict(kobo_data, kobotoken=None, koboasset=None):
downloadurl = attachment['download_url']
mimetype = attachment['mimetype']
attachments[filename] = {'url': downloadurl, 'mimetype': mimetype}
logging.info(f"attachments: {attachments}")
return attachments


Expand Down

0 comments on commit ab30d0f

Please sign in to comment.