diff --git a/bin/schoology b/bin/schoology index 76f169e..3813443 100755 --- a/bin/schoology +++ b/bin/schoology @@ -4,6 +4,7 @@ import click import schoolopy from json import loads import os +from shutil import rmtree home = os.getenv('HOME') @@ -36,9 +37,24 @@ def schoology(): @click.option('--secret', required=True, help='Your API secret') def login(key, secret): 'Connect to your schoology account' - open( - os.path.join(home, '.schoology', 'creds.json'), 'w+' - ).write('{"key": "%s", "secret": "%s"}' % (key, secret)) + try: + open( + os.path.join(home, '.schoology', 'creds.json'), 'w+' + ).write('{"key": "%s", "secret": "%s"}' % (key, secret)) + except: + try: + rmtree( + os.path.join(home, '.schoology', '.creds.json') + ) + except: + pass + os.mkdir( + os.path.join(home, '.schoology') + ) + open( + os.path.join(home, '.schoology', 'creds.json'), 'w+' + ).write('{"key": "%s", "secret": "%s"}' % (key, secret)) + @schoology.command() def logout(): diff --git a/docs/_coverpage.md b/docs/_coverpage.md index 4838d49..f4e1209 100644 --- a/docs/_coverpage.md +++ b/docs/_coverpage.md @@ -1,6 +1,6 @@ 🏫 -# Schoology v1.2 +# Schoology v2.1 > The Ultimate Schoology CLI diff --git a/setup.py b/setup.py index 7003658..5fea961 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setuptools.setup( name='schoology', - version='1.2', + version='2.1', author='Aarav Borthakur', author_email='gadhaguy13@gmail.com', description='The Ultimate Schoology CLI',