This is not a full reference guide. It's just a quick reminder for URL encoding.
I am studying OAuth and I am reviewing the signature base string for a signed request.
The base string has:
- Method of request: POST
- Parameters joined by
- include_entities = true
- oauth_consumer_key = weirdnumberhere
- oauth_signature_method = HMAC-SHA1
- oauth_token = otherweirdnumber
- oauth_version = 1.0
- status = The Chemical Brothers
POST&https%3A%2F%2Fapi.twitter.com%%2Fstatuses%2F update.json&include_entities%3Dtrue%26 oauth_consumer_key%3Dweirdnumberhere%26 oauth_signature_method%3DHMAC-SHA1%26oauth_token%3D otherweirdnumber%26oauth_version%3D1.0%26 status%3DThe%20Chemical%20Brothers
Converting character to hex in Python
The first part of the string is:
You can get the character encoding to hex using
>>> hex(ord(':')) '0x3a' >>> hex(ord('/')) '0x2f'
This is the conversion:
These are the conversions:
>>> hex(ord('=')) '0x3d' >>> hex(ord('&')) '0x26' >>> hex(ord(' ')) '0x20'