This commit is contained in:
@@ -138,10 +138,11 @@ def save_metadata(metadata):
|
|||||||
# Escape special characters in name for Influx Line Protocol
|
# Escape special characters in name for Influx Line Protocol
|
||||||
name = name.replace(' ', '\\ ').replace(',', '\\,').replace('"', '\\"')
|
name = name.replace(' ', '\\ ').replace(',', '\\,').replace('"', '\\"')
|
||||||
|
|
||||||
line = f'metadata,isin={isin} name="{name}",country="{country}",continent="{continent}",sector="{sector}"'
|
# QuestDB requires a newline at the end of the line protocol
|
||||||
|
line = f'metadata,isin={isin} name="{name}",country="{country}",continent="{continent}",sector="{sector}"\n'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = requests.post(f"http://{DB_HOST}:9000/write", data=line + "\n", auth=DB_AUTH)
|
response = requests.post(f"http://{DB_HOST}:9000/write", data=line, auth=DB_AUTH)
|
||||||
if response.status_code not in [200, 204]:
|
if response.status_code not in [200, 204]:
|
||||||
logger.error(f"Error saving metadata: {response.text}")
|
logger.error(f"Error saving metadata: {response.text}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user