Skip to content
This repository was archived by the owner on Aug 26, 2021. It is now read-only.

Commit 349d100

Browse files
Python 3 support
1 parent 6ec4245 commit 349d100

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

flask_heroku.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
#!/usr/bin/env python
22

3-
import urlparse
43
from os import environ
4+
try:
5+
from urllib.parse import urlparse
6+
except ImportError:
7+
from urlparse import urlparse
58

69
class Heroku(object):
710
"""Heroku configurations for flask."""
@@ -49,15 +52,15 @@ def init_app(self, app):
4952
# Redis To Go
5053
redis_url = environ.get('REDISTOGO_URL')
5154
if redis_url:
52-
url = urlparse.urlparse(redis_url)
55+
url = urlparse(redis_url)
5356
app.config.setdefault('REDIS_HOST', url.hostname)
5457
app.config.setdefault('REDIS_PORT', url.port)
5558
app.config.setdefault('REDIS_PASSWORD', url.password)
5659

5760
# Mongolab
5861
mongolab_uri = environ.get('MONGOLAB_URI')
5962
if mongolab_uri:
60-
url = urlparse.urlparse(mongolab_uri)
63+
url = urlparse(mongolab_uri)
6164
app.config.setdefault('MONGO_URI', mongolab_uri)
6265
app.config.setdefault('MONGODB_USER', url.username)
6366
app.config.setdefault('MONGODB_PASSWORD', url.password)
@@ -68,7 +71,7 @@ def init_app(self, app):
6871
# MongoHQ
6972
mongohq_uri = environ.get('MONGOHQ_URL')
7073
if mongohq_uri:
71-
url = urlparse.urlparse(mongohq_uri)
74+
url = urlparse(mongohq_uri)
7275
app.config.setdefault('MONGO_URI', mongohq_uri)
7376
app.config.setdefault('MONGODB_USER', url.username)
7477
app.config.setdefault('MONGODB_PASSWORD', url.password)

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
'License :: OSI Approved :: BSD License',
3030
'Operating System :: OS Independent',
3131
'Programming Language :: Python',
32+
'Programming Language :: Python :: 3',
3233
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
3334
'Topic :: Software Development :: Libraries :: Python Modules'
3435
]

0 commit comments

Comments
 (0)