Skip to content

Commit

Permalink
Merge pull request InstaPy#2249 from ilmetu/patch-4
Browse files Browse the repository at this point in the history
use different chromedriver for os environment
  • Loading branch information
timgrossmann authored Aug 8, 2018
2 parents 5e5282e + 8139978 commit d2bf9c2
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion instapy/settings.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,35 @@
import os


BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

def get_os_env():
from sys import platform
if platform == "linux" or platform == "linux2":
return 'linux'
elif platform == "darwin":
return 'osx'
elif platform == "win32":
return 'windows'

class Settings:
log_location = os.path.join(BASE_DIR, 'logs')
database_location = os.path.join(BASE_DIR, 'db', 'instapy.db')
os_env = get_os_env()

chromedriver_location = os.path.join(BASE_DIR, 'assets', 'chromedriver')

if os_env == 'osx':
chromedriver_location = os.path.join(BASE_DIR, 'assets', 'chromedriver_osx')

if os_env == 'linux':
chromedriver_location = os.path.join(BASE_DIR, 'assets', 'chromedriver_linux')

if os_env == 'windows':
chromedriver_location = os.path.join(BASE_DIR, 'assets', 'chromedriver_windows')

if not os.path.exists(chromedriver_location):
chromedriver_location = os.path.join(BASE_DIR, 'assets', 'chromedriver')

chromedriver_min_version = 2.36
# Set a logger cache outside the InstaPy object to avoid re-instantiation issues
loggers = {}
Expand Down

0 comments on commit d2bf9c2

Please sign in to comment.