On 2011-01-06, Slie <stacks...@gmail.com> wrote: [reformated to <80 columns per RFC 1855 guidelines] > I have read several examples on python post requests but I'm not sure > mine needs to be that complicated.
>From the HTML example on the page you posted: <form action='https://chart.googleapis.com/chart' method='POST'> <input type="hidden" name="cht" value="lc" /> <input type="hidden" name="chtt" value="This is | my chart" /> <input type='hidden' name='chs' value='600x200' /> <input type="hidden" name="chxt" value="x,y" /> <input type='hidden' name='chd' value='t:40,20,50,20,100'/> <input type="submit" /> </form> you can retreive the same chart from Python: Python 3.1.2 (r312:79147, Oct 9 2010, 00:16:06) [GCC 4.4.4] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import urllib.request, urllib.parse >>> params = urllib.parse.urlencode({'cht':'lc', 'chtt':'This is | my >>> chart', ... 'chs':'600x200', 'chxt':'x,y', 'chd':'t:40,20,50,20,100'}) >>> chart = urllib.request.urlopen('https://chart.googleapis.com/chart', ... data = params).read() >>> chartFile = open("chart.png", 'wb') >>> chartFile.write(chart) 10782 >>> chartFile.close() -- http://mail.python.org/mailman/listinfo/python-list