From 80ff03e4b18eca4d1dc94fe3403b1180c198f160 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?= Date: Thu, 5 Sep 2019 17:13:35 +0200 Subject: [PATCH] libcanvas/Canvas.py, libgui/GuiCanvasInterface.py: correctly set ImgurApiKey. libcanvas/CanvasExportStore.py:_exportFileToImgur(): fixed. libcanvas/CanvasExportStore.py:exportPastebin(): fixed. --- libcanvas/Canvas.py | 2 -- libcanvas/CanvasExportStore.py | 4 ++-- libgui/GuiCanvasInterface.py | 3 ++- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/libcanvas/Canvas.py b/libcanvas/Canvas.py index 6761249..215f685 100644 --- a/libcanvas/Canvas.py +++ b/libcanvas/Canvas.py @@ -8,7 +8,6 @@ from CanvasBackend import CanvasBackend from CanvasJournal import CanvasJournal from CanvasExportStore import CanvasExportStore, havePIL, haveUrllib from CanvasImportStore import CanvasImportStore -from ImgurApiKey import ImgurApiKey import wx class Canvas(wx.Panel): @@ -177,7 +176,6 @@ class Canvas(wx.Panel): self._canvasDirty, self._canvasDirtyCursor = False, False self.canvasMap, self.canvasPos, self.canvasSize, = None, defaultCanvasPos, defaultCanvasSize self.defaultCanvasPos, self.defaultCanvasSize, self.defaultCellSize = defaultCanvasPos, defaultCanvasSize, defaultCellSize - self.imgurApiKey = ImgurApiKey.imgurApiKey self.parentFrame = parentFrame self.parentFrame.onCanvasUpdate(brushSize=self.brushSize, colours=self.brushColours) diff --git a/libcanvas/CanvasExportStore.py b/libcanvas/CanvasExportStore.py index d1410a5..a9784bc 100644 --- a/libcanvas/CanvasExportStore.py +++ b/libcanvas/CanvasExportStore.py @@ -49,7 +49,7 @@ class CanvasExportStore(): "title": imgTitle, \ "type": "base64"} requestHeaders = {"Authorization": "Client-ID " + apiKey} - responseHttp = requests.post(ImgurUploadUrl, data=requestData, headers=requestHeaders) + responseHttp = requests.post(self.ImgurUploadUrl, data=requestData, headers=requestHeaders) responseDict = json.loads(responseHttp.text) if responseHttp.status_code == 200: return [200, responseDict.get("data").get("link")] @@ -105,7 +105,7 @@ class CanvasExportStore(): "api_paste_code": outFile.getvalue().encode(), \ "api_paste_name": pasteName, \ "api_paste_private": pastePrivate} - responseHttp = requests.post(PastebinPostUrl, data=requestData) + responseHttp = requests.post(self.PastebinPostUrl, data=requestData) if responseHttp.status_code == 200: if responseHttp.text.startswith("http"): return (True, responseHttp.text) diff --git a/libgui/GuiCanvasInterface.py b/libgui/GuiCanvasInterface.py index b0347c9..6b0f183 100644 --- a/libgui/GuiCanvasInterface.py +++ b/libgui/GuiCanvasInterface.py @@ -14,6 +14,7 @@ from ToolText import ToolText from glob import glob from GuiCanvasInterfaceAbout import GuiCanvasInterfaceAbout +from ImgurApiKey import ImgurApiKey import io, os, random, wx, wx.adv class GuiCanvasInterface(): @@ -425,7 +426,7 @@ class GuiCanvasInterface(): # # __init__(self, parentCanvas, parentFrame): def __init__(self, parentCanvas, parentFrame): - self.canvasPathName, self.imgurApiKey = None, None + self.canvasPathName, self.imgurApiKey = None, ImgurApiKey.imgurApiKey self.parentCanvas, self.parentFrame = parentCanvas, parentFrame self.canvasToolRect(None)