Changing proxies with urllib

Radovan Garabik garabik-news at spam.melkor.dnp.fmph.uniba.sk
Sat Nov 11 08:10:07 EST 2000


David Leinbach <leinbach at telus.net> wrote:
 : If I am using urllib to open a webpage, how can change what proxy it
 : goes through while my program is running?  Can I just change the
 : environment variable?   Thanks

No, (at least under unix) it is impossible to change the environmental
variable from within script. 
However, you can change the values in os.environ dictionary,
and urllib uses these values, so the resulting behaviour is exactly
what you want.


-- 
 -----------------------------------------------------------
| Radovan Garabik http://melkor.dnp.fmph.uniba.sk/~garabik/ |
| __..--^^^--..__    garabik @ melkor.dnp.fmph.uniba.sk     |
 -----------------------------------------------------------
Antivirus alert: file .signature infected by signature virus.
Hi! I'm a signature virus! Copy me into your signature file to help me spread!



More information about the Python-list mailing list