Skip to content

Commit

Permalink
Fix login bug
Browse files Browse the repository at this point in the history
  • Loading branch information
gadhagod committed Nov 8, 2020
1 parent 2730716 commit 729363b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
22 changes: 19 additions & 3 deletions bin/schoology
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import click
import schoolopy
from json import loads
import os
from shutil import rmtree

home = os.getenv('HOME')

Expand Down Expand Up @@ -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():
Expand Down
2 changes: 1 addition & 1 deletion docs/_coverpage.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
🏫

# Schoology <small>v1.2</small>
# Schoology <small>v2.1</small>

> The Ultimate Schoology CLI
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setuptools.setup(
name='schoology',
version='1.2',
version='2.1',
author='Aarav Borthakur',
author_email='[email protected]',
description='The Ultimate Schoology CLI',
Expand Down

0 comments on commit 729363b

Please sign in to comment.