Search code examples
palantir-foundry

Palantir Foundry forbids connection to external web service


I want to query weather information using the meteostat library. When doing so, however, Palantir Foundry forbids requests to the external web service. The code example below fails with the error message urllib.error.URLError: <urlopen error Tunnel connection failed: 403 Forbidden>. What can I do about this?

from dateutil import parser as dateparser
from meteostat import Point, Hourly


loc = Point(47.00823, 4.849133)
start = dateparser.parse("2021-09-20 13:14:36+00:00")
end = dateparser.parse("2021-09-20 14:14:36+00:00")

# Queries information from an external source (fails!)
data = Hourly(loc, start, end)
data = data.fetch()

Solution

  • Code repositories by default have all the external communication disabled. To enable it you can follow this documentation: https://www.palantir.com/docs/foundry/transforms-python/external-transforms/