A notebook’s Python code runs in its selected kernel. Set proxy variables in that process before the HTTP client uses them. For Requests with its normal environment handling, a setup cell can contain:

import os

os.environ["http_proxy"] = "http://proxy.example.net:8080"
os.environ["https_proxy"] = "http://proxy.example.net:8080"

The proxy URL describes an HTTP intermediary in both assignments. Do not change its scheme merely because the destination website uses HTTPS. For permitted public Python requests whose client has no proxy account configured, an HTTP entry from the HTTP proxy list can supply those values.

For repeated IPython sessions, startup scripts belong to the selected IPython profile’s startup directory, commonly ~/.ipython/profile_default/startup/. These files execute when the IPython shell is constructed, so changing one requires starting a new kernel to rerun it. Jupyter’s server configuration directory serves a different purpose.

A kernelspec can also supply additional environment values for a newly launched kernel. Managed or remote kernels may have their own launch environment; check the selected kernel rather than assuming it shares the shell that opened the browser.

If the problem is opening the local notebook page itself, inspect the browser’s localhost bypass policy. A proxy-aware Python download and a browser connection to the Jupyter server are separate requests. An embedded webpage in an IFrame also uses the browser’s route.

Tënë sô zo