Skip to content

Commit

Permalink
make both external and local files import correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
jarno-knaw committed Sep 17, 2024
1 parent cd412ed commit f9c908c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/graphdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,17 @@ def add_vocabulary(graph: TextIO, graph_name: str, extension: str) -> None:
"""
print(f"Adding vocabulary {graph_name}")
content = graph.read()
try:
content = content.encode('utf-8')
except (UnicodeDecodeError, AttributeError):
pass

headers = {
'Content-Type': get_type(extension),
}
response = requests.put(
f"{endpoint}/statements",
data=content.encode('utf-8'),
data=content,
headers=headers,
auth=(admin_username, admin_password),
params={'context': f"<{graph_name}>"},
Expand Down

0 comments on commit f9c908c

Please sign in to comment.