Skip to content

Instantly share code, notes, and snippets.

@BlueSkyDetector
Created February 14, 2013 02:09
Show Gist options
  • Save BlueSkyDetector/4950116 to your computer and use it in GitHub Desktop.
Save BlueSkyDetector/4950116 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
### setting start ###
import urllib2, cookielib
login_url = 'http://192.168.0.16/zabbix/index.php'
graph_url = 'http://192.168.0.16/zabbix/chart2.php'
name = 'Admin'
password = 'zabbix'
graphid = 388
output_file = 'out_graph.jpg'
### setting end ###
c = cookielib.CookieJar()
ch = urllib2.HTTPCookieProcessor(c)
op = urllib2.build_opener(ch)
r = op.open(login_url,"form_refresh=1&name;=%s&password;=%s&enter=Enter" % (name, password))
r = op.open(graph_url + "?graphid=" + str(graphid))
f = open(output_file,'wb')
f.write(r.read())
f.close()
r.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment