diff --git a/simplegist/comments.py b/simplegist/comments.py index 06444fd..5d5fe42 100644 --- a/simplegist/comments.py +++ b/simplegist/comments.py @@ -1,6 +1,6 @@ import json import requests -from config import BASE_URL, GIST_URL +from .config import BASE_URL, GIST_URL class Comments: def __init__(self, gist): @@ -226,4 +226,4 @@ def edit(self, **args): } - raise Exception('Comment not edited') \ No newline at end of file + raise Exception('Comment not edited') diff --git a/simplegist/do.py b/simplegist/do.py index 09e948b..2de0033 100644 --- a/simplegist/do.py +++ b/simplegist/do.py @@ -1,6 +1,6 @@ import json import requests -from config import BASE_URL, GIST_URL +from .config import BASE_URL, GIST_URL class Do: def __init__(self, gist): @@ -127,4 +127,4 @@ def checkifstar(self, **args): 'starred': 'False' } - return response \ No newline at end of file + return response diff --git a/simplegist/mygist.py b/simplegist/mygist.py index ef0601e..a4a5741 100644 --- a/simplegist/mygist.py +++ b/simplegist/mygist.py @@ -1,6 +1,6 @@ import json import requests -from config import BASE_URL, GIST_URL +from .config import BASE_URL, GIST_URL class Mygist: def __init__(self, gist, **args): @@ -272,4 +272,4 @@ def links(self,**args): } return content - raise Exception('No such gist found') \ No newline at end of file + raise Exception('No such gist found') diff --git a/simplegist/simplegist.py b/simplegist/simplegist.py index bc739f7..5449152 100644 --- a/simplegist/simplegist.py +++ b/simplegist/simplegist.py @@ -1,11 +1,11 @@ import requests import json -from config import USERNAME, API_TOKEN, BASE_URL, GIST_URL +from .config import USERNAME, API_TOKEN, BASE_URL, GIST_URL -from mygist import Mygist -from do import Do -from comments import Comments +from .mygist import Mygist +from .do import Do +from .comments import Comments class Simplegist: """ @@ -78,7 +78,7 @@ def create(self, **args): url = '/gists' data = {"description": self.description, - "public": self.public, + "public": bool(self.public), "files": { self.gist_name: { "content": self.content @@ -89,17 +89,11 @@ def create(self, **args): r = requests.post( '%s%s' % (BASE_URL, url), data=json.dumps(data), - headers=self.header - ) + headers=self.header) + if (r.status_code == 201): - response = { - 'Gist-Link': '%s/%s/%s' %(GIST_URL,self.username,r.json()['id']), - 'Clone-Link': '%s/%s.git' %(GIST_URL,r.json()['id']), - 'Embed-Script': '