DCU Proxy And Scripts: Difference between revisions

From Redbrick Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
 
Line 1: Line 1:
Have you ever tried to run a script on Redbrick that communicates with external websites and found that it doesn't work?
Have you ever tried to run a script on Redbrick that communicates with external websites and found that it doesn't work?


This might be due to the proxy being set wrong. For example on [Installing Wordpress on Redbrick|Installing Wordpress]] the proxy must be set manually in one of the files.
This might be due to the proxy being set wrong. For example on [[Installing Wordpress on Redbrick|Installing Wordpress]] the proxy must be set manually in one of the files.


The proxy on Redbrick is 'http://proxy.dcu.ie:8080'. This is normally set via enviromental variables that your script can pick up. This variables are case-sensitive.
The proxy on Redbrick is 'http://proxy.dcu.ie:8080'. This is normally set via enviromental variables that your script can pick up. This variables are case-sensitive.

Latest revision as of 23:54, 29 August 2009

Have you ever tried to run a script on Redbrick that communicates with external websites and found that it doesn't work?

This might be due to the proxy being set wrong. For example on Installing Wordpress the proxy must be set manually in one of the files.

The proxy on Redbrick is 'http://proxy.dcu.ie:8080'. This is normally set via enviromental variables that your script can pick up. This variables are case-sensitive.

HTTP_PROXY=proxy.dcu.ie:8080
FTP_PROXY=proxy.dcu.ie:8080
http_proxy=http://proxy.dcu.ie:8080
ftp_proxy=http://proxy.dcu.ie:8080

These variables break Python's 'urllib' module because it wants the 'HTTP_PROXY' setting but finds the 'http_proxy'. You can quickly fix this in your script by having:

os.environ['HTTP_PROXY'] = "http://proxy.dcu.ie:8080"

or

HTTP_PROXY = "http://proxy.dcu.ie:8080"

(or both) near the top of the Python script (at least after 'import os').