How does one encode and decode a string with Python for use in a URL?

un33k picture un33k · May 18, 2009 · Viewed 17.7k times · Source

I have a string like this:

String A: [ 12234_1_Hello'World_34433_22acb_4554344_accCC44 ]

I would like to encrypt String A to be used in a clean URL. something like this:

String B: [ cYdfkeYss4543423sdfHsaaZ ]

Is there a encode API in python, given String A, it returns String B? Is there a decode API in python, given String B, it returns String A?

Answer

alex picture alex · Jul 26, 2009

note that theres a huge difference between encoding and encryption.

if you want to send sensitive data, then dont use the encoding mentioned above ;)