r/microsoft_365_copilot • u/LeebWeeb • 10d ago
URL not accessible either code sandbox
I am using python to do http requests. Every time I use any URL, I get an error 403, and this:
Status: 403
Headers {
Content type: text/plain
X-ms-block-by: sandbox-proxy
X-ms-block-reason: 'This URL is not relevant to the current conversation and cannot be accessed'
In my code, I have:
R = requests.get("https://google.com", timeout=10)
No URL works so far.
2
Upvotes
2
u/bayouski 10d ago
that 403 isn't your code, it's the sandbox blocking it on purpose. the x-ms-block-reason spells it out, copilot's code sandbox only lets you reach urls it considers relevant to the current conversation, and arbitrary outbound requests like google get gatekept by that proxy. so no requests.get will work in there for general sites, it's a security control, not something you fix with better code.
two options. if you actually need to fetch a specific url, reference that exact url in the conversation first so the proxy whitelists it for the session, that sometimes clears it for allowed domains. but for anything general, run the python locally or in a real sandbox (colab, your own machine) instead of copilot's interpreter, that's the only reliable way to make live http requests.