Steps to replicate the issue (include links if applicable):
- the requests module is not available in python implementations
- using built-in http.client gives the error below
see https://www.wikifunctions.org/view/en/Z18320 for a failing test
implementation in python here: https://www.wikifunctions.org/view/en/Z18327
Relevant code:
# Fetch data from Wikidata
# Build the URL
url_path = f"/wiki/Special:EntityData/{entity}.json"
try:
# Establish a connection
conn = http.client.HTTPSConnection("www.wikidata.org")
conn.request("GET", url_path)
response = conn.getresponse()
# Check the status
if response.status >= 400:
return f"error: Got >= 400"
# Read the response data
data = response.read()
conn.close()
except Exception as e:
return f"error: during request: {e}"What happens?:
WF outputs this error:
Error type: Error in evaluation
Expected result: { "Z1K1": "Z40", "Z40K1": "Z41" }
Actual result: { "Z1K1": "Z5", "Z5K1": "Z507", "Z5K2": { "Z1K1": { "Z1K1": "Z7", "Z7K1": "Z885", "Z885K1": "Z507" }, "Z507K1": "No module named '_socket'" } }What should have happened instead?:
Given that _socket is NOT listed here https://rustpython.github.io/pages/whats-left the test should have passed instead of returning an error.
Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):
Other information (browser name/version, screenshots, etc.):