urllib.urlencode multidimensional dictionary

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • celery6541
    New Member
    • Mar 2007
    • 15

    urllib.urlencode multidimensional dictionary

    Hi all,

    I am trying to use urllib.urlencod e to post a multidimensiona l dictionary to a php page.

    This is the code I am using

    Code:
    test = {}
    test['boom'] = {}
    test['boom']['zoom'] = "bang"
    
    server_params = urllib.urlencode(test)
    
    response = urllib2.urlopen(server_url, server_params).read()
    And if I do a print of the post variable from php my output is looking like this

    Code:
    Array
    (
        [boom] => {\'zoom\': \'bang\'}
    )
    Only the first key of the dictionary is being preserved while everything underneath is being squished into a string.

    Is there a way to preserve the entire structure of the dictionary?

    Thanks!
Working...