Skip to content

Commit

Permalink
Use HTTPS version of Urban Dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
flebel committed Feb 13, 2018
1 parent 86c9d92 commit 4cad307
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ beautifulsoup4==4.3.2
flask==0.10.1
gunicorn==18.0
newrelic==2.40.0.34
requests[security]==2.18.4

6 changes: 3 additions & 3 deletions urban-word-of-the-day.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python

import json
import urllib2
import requests

from flask import Flask
from flask.ext.cache import Cache
Expand All @@ -11,13 +11,13 @@
APP = Flask(__name__)
CACHE = Cache(APP, config={'CACHE_TYPE': 'simple'})
CACHE_TIMEOUT = 1800 # 30 minutes
URL = 'http://www.urbandictionary.com'
URL = 'https://www.urbandictionary.com'

def get_wod(day=0):
if day > 6:
raise LookupError('Words of the day older than one week from today are not available.')

content = urllib2.urlopen(URL).read()
content = requests.get(URL).text
soup = BeautifulSoup(content)
words = []
meanings = []
Expand Down

0 comments on commit 4cad307

Please sign in to comment.