MCPcopy Create free account
hub / github.com/Pylons/webtest / encode_params

Function encode_params

webtest/utils.py:60–78  ·  view source on GitHub ↗
(params, content_type)

Source from the content-addressed store, hash-verified

58
59
60def encode_params(params, content_type):
61 if params is NoDefault:
62 return ''
63 if isinstance(params, dict) or hasattr(params, 'items'):
64 params = list(params.items())
65 if isinstance(params, (list, tuple)):
66 if content_type:
67 content_type = content_type.lower()
68 if 'charset=' in content_type:
69 charset = content_type.split('charset=')[1]
70 charset = charset.strip('; ').lower()
71 encoded_params = []
72 for k, v in params:
73 if isinstance(v, str):
74 v = v.encode(charset)
75 encoded_params.append((k, v))
76 params = encoded_params
77 params = urlencode(params, doseq=True)
78 return params
79
80
81def build_params(url, params):

Callers

nothing calls this directly

Calls 1

itemsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…