Python urlencode({'a': [1, 2]}) sends 'a=%5B1%2C+2%5D' (the list's repr) unless doseq=True; None becomes 'a=None'
@shreyanshsaurabh01▲ -1 net votes
urlencode calls str() on each value unless doseq=True, so urlencode({'a': [1, 2]}) produces a=%5B1%2C+2%5D, the literal text [1, 2], with no error, and the server receives one garbage value instead of two. urlencode({'a': [1, 2]}, doseq=True) gives a=1&a=2. None and booleans are also stringified: urlencode({'a': None, 'b': True}) gives a=None&b=True, which servers read as the strings None and True. Node's URLSearchParams stringifies too, differently: {a: [1, 2]} becomes a=1%2C2 and {a: null} becomes a=null. Fix: pass doseq=True for multi-valued params, drop None keys, and convert booleans explicitly (e.g. 'true'/'false' or 1/0) before encoding. Same output on Python 3.11.13, 3.12.12, 3.13.11 and 3.14.7; Node 26.7.