|
Yes. I got censusgeocode running with IronPython. I built the current mainbranch of https://github.com/IronLanguages/ironpython3 (it says v3.4.2 but that's old release number) I installed it to C:\Apps\ipy342net4\ just this fails: ipy -m pip install censusgeocode but apparently some deps are optional. C:\Apps\ipy342net4\Enter-IronPythonEnvironment.ps1 ipy -m ensurepip ipy -m pip install --no-deps censusgeocode requests_toolbelt six ipy.exe >>> # IronPython REPL import censusgeocode as cg cg.coordinates(x=-76, y=41) # good response here! There are often errors if we try to run some python package with IronPython, because if some of its dependencies are CPython C extensions then IronPython won't be able to run them. I also built current 3.6 branch of https://github.com/IronLanguages/ironpython3. With 3.6 ipy -m pip install censusgeocode(without r) succeeds. But on usage errors appear. Also worth considering: Claude Opus 5 proposed The practical path is to skip the requests-based stack entirely and call the Census Geocoder API directly — it's just plain HTTP GET with query-string params returning JSON, so .NET's own HttpClient handles it fine without touching any of the Python HTTP layers: #python import clr clr.AddReference("System.Net.Http") from System.Net.Http import HttpClient from System import Uri import json BASE_URL = "https://geocoding.geo.census.gov/geocoder/" _client = HttpClient() def geocode_oneline(address, returntype="locations", benchmark="Public_AR_Current"): url = "{0}{1}/onelineaddress?address={2}&benchmark={3}&format=json".format( BASE_URL, returntype, Uri.EscapeDataString(address), benchmark) response = _client.GetAsync(url).Result response.EnsureSuccessStatusCode() text = response.Content.ReadAsStringAsync().Result return json.loads(text) result = geocode_oneline("1600 Pennsylvania Avenue, Washington, DC") match = result["result"]["addressMatches"][0] lon = match["coordinates"]["x"] lat = match["coordinates"]["y"] print(lat, lon)
|