From a05c410372162c4ab598f6e2758f588578958f2e Mon Sep 17 00:00:00 2001 From: niristotle okram Date: Tue, 10 Oct 2017 14:52:15 -0500 Subject: [PATCH] Adding the SSL Context for use TLS1.2 --- elf.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/elf.py b/elf.py index 5b1299d..c3559dd 100755 --- a/elf.py +++ b/elf.py @@ -45,7 +45,7 @@ import urllib2 import json -#import ssl +import ssl import getpass import os import sys @@ -54,6 +54,9 @@ from StringIO import StringIO import base64 +#create the ssl context +ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2) + # login function def login(): ''' Login to salesforce service using OAuth2 ''' @@ -94,7 +97,7 @@ def login(): # call salesforce REST API and pass in OAuth credentials req = urllib2.Request(url, data, headers) - res = urllib2.urlopen(req) + res = urllib2.urlopen(req, context=ctx) # load results to dictionary res_dict = json.load(res)