Skip to content

Commit 95dc1c5

Browse files
author
Mike Krieger
committed
Central json import logic
1 parent 417f5b2 commit 95dc1c5

File tree

3 files changed

+12
-23
lines changed

3 files changed

+12
-23
lines changed

instagram/bind.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
11
import urllib
22
from oauth2 import OAuth2Request
33
import re
4-
5-
try:
6-
import simplejson
7-
except ImportError:
8-
try:
9-
import json as simplejson
10-
except ImportError:
11-
try:
12-
from django.utils import simplejson
13-
except ImportError:
14-
raise ImportError('A json library is required to use this python library. Lol, yay for being verbose. ;)')
4+
from json_import import simplejson
155

166
re_path_template = re.compile('{\w+}')
177

instagram/json_import.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
try:
2+
import simplejson
3+
except ImportError:
4+
try:
5+
import json as simplejson
6+
except ImportError:
7+
try:
8+
from django.utils import simplejson
9+
except ImportError:
10+
raise ImportError('A json library is required to use this python library')

instagram/subscriptions.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
11
import hmac
22
import hashlib
3-
4-
try:
5-
import simplejson
6-
except ImportError:
7-
try:
8-
import json as simplejson
9-
except ImportError:
10-
try:
11-
from django.utils import simplejson
12-
except ImportError:
13-
raise ImportError('A json library is required to use this python library. Lol, yay for being verbose. ;)')
14-
3+
from json_import import simplejson
154

165
class SubscriptionType:
176
TAG = 'tag'

0 commit comments

Comments
 (0)