values with space doesn't pass with %20


New Member
somehow other special characters can be passed in the values, but space doesn't. I tried %20 and + for whitespace but no luck. Is there anything that I am missing on this?

For eg)
'Senior programmer' cannot be passed even though I change it to 'Senior%20programmer' or 'Senior+programmer' by using urllib.quote(myjob) in Python.

Posting this problem here with my luck!

Thank you.
@KenKen - Please provide some code to show how your going about this as it gives us a better idea on how to assist otherwise we are guessing just as much as you are.

Otherwise urllib should pass the url with the whitespaces if you import urllib

import urllib
url = urllib.quote(" url with whitespaces")

Hi BirdyUK, found that it works when I pass data as param (urllib.urlencode(params)) instead of encoding each value with urllib.quote(value)

Thank you for your fast response. Hope this post can be helpful for other users.

def subscribe_user_mail():
#Required POST values
method = 'POST'
action = 'lists'
uid = '1234uid'
params = {
   'FNAME':'Jo jo'
url = "" % (action+'/'+uid+'/subscribers?'+urlllib.urlencode(params))
public_key = '1234publickey'
private_key = '1234privatekey'
current_time = str(int(time.time()))
remote_addr = ''

#Add three values into the header
headers_o = {
'X-MW-PUBLIC-KEY': public_key,
'X-MW-TIMESTAMP': current_time,
'X-MW-REMOTE-ADDR': remote_addr

#Order header keys by asc
headers = collections.OrderedDict(sorted(headers_o.items()))

#Create special signature
signature_string = ''.join([method.upper(), ' ', url, '&', urllib.urlencode(headers)])
signature =, signature_string, hashlib.sha1).hexdigest()

#Add special signature in the header
headers['X-MW-SIGNATURE'] = signature

#Send POST request
response =
#Print output
return response
#Print POST url and url accessed via API
return response.url +','+signature_string
Last edited: