574bbda780d38a44fb263ba6065a22a30944896b
[plcapi.git] / pycurl / tests / test_post.py
1 #! /usr/bin/env python
2 # -*- coding: iso-8859-1 -*-
3 # vi:ts=4:et
4 # $Id: test_post.py,v 1.9 2003/04/21 18:46:11 mfx Exp $
5
6 import urllib
7 import pycurl
8
9 # simple
10 pf = {'field1': 'value1'}
11
12 # multiple fields
13 pf = {'field1':'value1', 'field2':'value2 with blanks', 'field3':'value3'}
14
15 # multiple fields with & in field
16 pf = {'field1':'value1', 'field2':'value2 with blanks and & chars',
17       'field3':'value3'}
18
19 c = pycurl.Curl()
20 c.setopt(c.URL, 'http://pycurl.sourceforge.net/tests/testpostvars.php')
21 c.setopt(c.POSTFIELDS, urllib.urlencode(pf))
22 c.setopt(c.VERBOSE, 1)
23 c.perform()
24 c.close()