Skip to content

Commit 052b026

Browse files
committed
Move non-helpful stuff into their own file
1 parent 00eed5f commit 052b026

2 files changed

Lines changed: 21 additions & 16 deletions

File tree

examples/auth.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,7 @@
77
'''
88

99
from imgurpython import ImgurClient
10-
11-
def get_input(string):
12-
''' Get input from console regardless of python 2 or 3 '''
13-
try:
14-
return raw_input(string)
15-
except:
16-
return input(string)
17-
18-
def get_config():
19-
''' More version compatibility stuff '''
20-
try:
21-
import ConfigParser
22-
return ConfigParser.ConfigParser()
23-
except:
24-
import configparser
25-
return configparser.ConfigParser()
10+
from helpers import get_input, get_config
2611

2712
def authenticate():
2813
# Get client ID and secret from auth.ini

examples/helpers.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
'''
2+
These functions have nothing to do with the API, they just help ease
3+
issues between Python 2 and 3
4+
'''
5+
6+
def get_input(string):
7+
''' Get input from console regardless of python 2 or 3 '''
8+
try:
9+
return raw_input(string)
10+
except:
11+
return input(string)
12+
13+
def get_config():
14+
''' Create a config parser for reading INI files '''
15+
try:
16+
import ConfigParser
17+
return ConfigParser.ConfigParser()
18+
except:
19+
import configparser
20+
return configparser.ConfigParser()

0 commit comments

Comments
 (0)