send data with json content type (#85)

master
Mike Di Nicola 1 year ago committed by GitHub
parent f2fd111377
commit cfe9a7198b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -266,7 +266,7 @@ def sync_servers(instanceA_contents, instanceB_language_id, instanceB_contentIds
elif content_not_synced: elif content_not_synced:
# sync content if not synced # sync content if not synced
logging.info(f'syncing content title "{title}"') logging.info(f'syncing content title "{title}"')
sync_response = instanceB_session.post(instanceB_content_url, data=json.dumps(formatted_content)) sync_response = instanceB_session.post(instanceB_content_url, json=formatted_content)
# check response and save content id for searching later on if success # check response and save content id for searching later on if success
if sync_response.status_code != 201 and sync_response.status_code != 200: if sync_response.status_code != 201 and sync_response.status_code != 200:
logger.error(f'server sync error for {title} - response: {sync_response.text}') logger.error(f'server sync error for {title} - response: {sync_response.text}')
@ -288,7 +288,7 @@ def sync_servers(instanceA_contents, instanceB_language_id, instanceB_contentIds
if matching_content_instanceB['monitored'] != content['monitored']: if matching_content_instanceB['monitored'] != content['monitored']:
matching_content_instanceB['monitored'] = content['monitored'] matching_content_instanceB['monitored'] = content['monitored']
instanceB_content_url = get_content_put_path(instanceB_url, instanceB_key, matching_content_instanceB.get('id')) instanceB_content_url = get_content_put_path(instanceB_url, instanceB_key, matching_content_instanceB.get('id'))
sync_response = instanceB_session.put(instanceB_content_url, data=json.dumps(matching_content_instanceB)) sync_response = instanceB_session.put(instanceB_content_url, json=matching_content_instanceB)
# check response and save content id for searching later on if success # check response and save content id for searching later on if success
if sync_response.status_code != 202: if sync_response.status_code != 202:
logger.error(f'server monitoring sync error for {title} - response: {sync_response.text}') logger.error(f'server monitoring sync error for {title} - response: {sync_response.text}')

Loading…
Cancel
Save