Skip to content

Commit

Permalink
Merge pull request #49 from UCF/hf-v1.0.10
Browse files Browse the repository at this point in the history
Creating an ssl context
  • Loading branch information
jmbarne3 authored Jun 2, 2020
2 parents b24634c + e8a11dd commit 94f7a7f
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions util.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,21 @@
from django.conf import settings
import ldap

import urllib, json
import urllib, json, ssl

def get_header_menu_items():
response = urllib.urlopen(settings.REMOTE_MENU_HEADER)
data = json.loads(response.read())
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE

try:
response = urllib.urlopen(settings.REMOTE_MENU_HEADER, context=ctx)
except:
response = None

if response:
data = json.loads(response.read())

try:
items = data['items']
except Exception, e:
Expand All @@ -17,8 +27,18 @@ def get_header_menu_items():
return items

def get_footer_menu_items():
response = urllib.urlopen(settings.REMOTE_MENU_FOOTER)
data = json.loads(response.read())
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE

try:
response = urllib.urlopen(settings.REMOTE_MENU_FOOTER, context=ctx)
except:
response = None

if response:
data = json.loads(response.read())

try:
items = data['items']
except Exception, e:
Expand Down

0 comments on commit 94f7a7f

Please sign in to comment.