Use named version attributes (new in Py2.7)
@@ -39,14 +39,14 @@ __license__ = "apache2"
__email__ = 'amr.hassan@gmail.com'
-if sys.version_info[0] == 3:
+if sys.version_info.major == 3:
import html.entities as htmlentitydefs
from http.client import HTTPSConnection
from urllib.parse import quote_plus as url_quote_plus
unichr = chr
-elif sys.version_info[0] == 2:
+elif sys.version_info.major == 2:
import htmlentitydefs
from httplib import HTTPSConnection
from urllib import quote_plus as url_quote_plus
@@ -2608,7 +2608,7 @@ def _string(string):
if isinstance(string, str):
return string
casted = six.text_type(string)
- if sys.version_info[0] == 2:
+ if sys.version_info.major == 2:
casted = casted.encode("utf-8")
return casted
