Author vitaly.krug
Recipients christian.heimes, vitaly.krug
Date 2018-03-08.06:57:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In [9]: from urllib.parse import urlencode, parse_qs

In [10]: import ast, ssl

In [11]: d = dict(cert_reqs=ssl.CERT_NONE)

In [12]: urlencode(d)
Out[12]: 'cert_reqs=VerifyMode.CERT_NONE'

In [25]: parse_qs('cert_reqs=VerifyMode.CERT_NONE')
Out[25]: {'cert_reqs': ['VerifyMode.CERT_NONE']}
In [29]: ast.literal_eval('VerifyMode.CERT_NONE')
Traceback (most recent call last)
ValueError: malformed node or string: <_ast.Attribute object at 0x105c22358>

This used to work fine and produce `'cert_reqs=0'` on Python 2.7, allowing it to be decoded properly downstream. However, `'cert_reqs=VerifyMode.CERT_NONE'` can't be decoded generically. So, something it's that used to work in prior python versions that is breaking now.

Additional information. json.dumps() actually dumps that value as a number instead of 'VerifyMode.CERT_NONE'. 

It appears that urlencode doesn't work properly with enums, where I would expect it to emit the numeric value of the enum.
Date User Action Args
2018-03-08 06:57:47vitaly.krugsetrecipients: + vitaly.krug, christian.heimes
2018-03-08 06:57:47vitaly.krugsetmessageid: <>
2018-03-08 06:57:47vitaly.kruglinkissue33025 messages
2018-03-08 06:57:47vitaly.krugcreate