I have a new and relatively empty Omeka S installation where I can access API results in a browser window but with a python script I get “‘Connection aborted.’, RemoteDisconnected(‘Remote end closed connection without response’”
My API url: https://maevekane.net/mni-archive/api/items
My code:
import requests
import json
url = "https://maevekane.net/mni-archive/api/items"
try:
results = requests.get(url) # make a variable that will call the url and contain the data that is requested
results.raise_for_status() # Raise an HTTPError for bad responses (4xx or 5xx)
data = results.json()
print(data)
except requests.exceptions.ConnectionError as e:
print(f"Connection error. Details: {e}")
except requests.exceptions.Timeout as e:
print(f"Timeout Error. Details: {e}")
except requests.exceptions.RequestException as e:
print(f"An unexpected error occurred during the request. Details: {e}")
except json.JSONDecodeError:
print("Error: Could not decode JSON from the response. The server might have returned non-JSON data or an empty response.")
I can get other Omeka API results (eg, https://wardepartmentpapers.org/api/items) just fine with this code so I think it must be something with my own Omeka installation? The items are all public so I don’t think it’s an authentication issue.
Running Omeka S version 4.2.0, Reclaim hosting