MCPcopy Create free account
hub / github.com/csev/py4e / get_normalized_parameters

Method get_normalized_parameters

code/oauth.py:181–196  ·  view source on GitHub ↗

Return a string that contains the parameters that must be signed.

(self)

Source from the content-addressed store, hash-verified

179 return '%s?%s' % (self.get_normalized_http_url(), self.to_postdata())
180
181 def get_normalized_parameters(self):
182 """Return a string that contains the parameters that must be signed."""
183 # Chuck - Make a copy of the parameters so we can modify them
184 params = dict(self.parameters)
185 try:
186 # Exclude the signature if it exists.
187 del params['oauth_signature']
188 except:
189 pass
190 # Escape key values before sorting.
191 key_values = [(escape(_utf8_str(k)), escape(_utf8_str(v))) \
192 for k,v in params.items()]
193 # Sort lexicographically, first after key, then after value.
194 key_values.sort()
195 # Combine key value pairs into a string.
196 return '&'.join(['%s=%s' % (k, v) for k, v in key_values])
197
198 def get_normalized_http_method(self):
199 """Uppercases the http method."""

Callers 1

Calls 3

escapeFunction · 0.70
_utf8_strFunction · 0.70
itemsMethod · 0.45

Tested by

no test coverage detected