From ea99def3781fe7ca8b81190996815e1951d395bb Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Fri, 13 Sep 2013 10:42:16 +0300 Subject: Define IMAGE_URL as a module-level variable --- gsxws/parts.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gsxws/parts.py b/gsxws/parts.py index 1d21165..acf9957 100644 --- a/gsxws/parts.py +++ b/gsxws/parts.py @@ -6,6 +6,7 @@ import tempfile from lookups import Lookup from core import GsxObject, GsxError +IMAGE_URL = "https://km.support.apple.com.edgekey.net/kb/imageService.jsp?image=%s" class Part(GsxObject): """ @@ -26,7 +27,7 @@ class Part(GsxObject): raise GsxError("Cannot fetch part image without part number") image = "%s_350_350.gif" % self.partNumber - url = "https://km.support.apple.com.edgekey.net/kb/imageService.jsp?image=%s" % image + url = IMAGE_URL % image tmpfile = tempfile.mkstemp(suffix=image) try: @@ -41,5 +42,5 @@ if __name__ == '__main__': import logging from core import connect logging.basicConfig(level=logging.DEBUG) - connect(*sys.argv[1:5]) + connect(*sys.argv[1:]) doctest.testmod() -- cgit v1.2.3