Skip to content

Instantly share code, notes, and snippets.

@seungjin
Created June 1, 2011 16:21
Show Gist options
  • Select an option

  • Save seungjin/1002677 to your computer and use it in GitHub Desktop.

Select an option

Save seungjin/1002677 to your computer and use it in GitHub Desktop.
u of a uits is horrible. so I complain..
import httplib, urllib
from datetime import datetime
def send_complain_form() :
current_time = str(datetime.now())
destination = "http://uits.arizona.edu/contact"
mailto ="uits"
name = "Seung-jin Kim"
email = "seungjin@email.arizona.edu"
subject = "network down"
comment = "I cannot access Keating B/D network. Current time is %s. This is automatically/programatically generated email. I made this application because your network service is so horrible. If you have any question, please contact me at seungjin@email.arizona.edu. I wrote this program while you gave me network down" % current_time
method = "POST"
params = urllib.urlencode(
{
"mailto" : mailto,
"name" : name,
"email" : email,
"subject" : subject,
"comment" : comment
}
)
headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"}
conn = httplib.HTTPConnection("uits.arizona.edu:80")
conn.request("POST","/contact",params,headers)
response = conn.getresponse()
print response.status, response.reason
data = response.read()
print data
conn.close()
import subprocess
process = subprocess.Popen("ssh charon.iplantcollaborative.org -p 1657", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
output,stderr = process.communicate()
if output == "ssh: connect to host example.com port 22: Operation timed out\r\n" :
print "I hate UITS!"
send_complain_form()
else :
print "I love UITS!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment