diff --git a/.travis.yml b/.travis.yml index aa406ae..d642cc1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: python python: - - "2.7" + - "3.6" # command to install dependencies install: - python setup.py install diff --git a/setup.py b/setup.py index e842eb5..f0ae929 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name = 'Python-Spoke', - version = '1.0.10', + version = '1.0.31', packages = find_packages(), description = 'API bindings for Spoke API', long_description = open(os.path.join(os.path.dirname(__file__), 'README.md'), 'r').read(), @@ -12,6 +12,6 @@ author_email = 'rob.hoelz@skinnycorp.com', url = 'https://github.com/Threadless/python-spoke', keywords = 'spoke', - install_requires = ['lxml==3.3.5', 'requests==2.2.1'], - tests_require = ['nose==1.3.1', 'python-termstyle==0.1.10', 'rednose==0.4.1'], + install_requires = ['lxml==4.9.3', 'requests==2.27.0'], + tests_require = ['nose==1.3.7', 'rednose==1.3.0'], ) diff --git a/spoke/__init__.py b/spoke/__init__.py index d16d57a..68fe70e 100644 --- a/spoke/__init__.py +++ b/spoke/__init__.py @@ -7,8 +7,9 @@ from lxml import etree import requests +import six -__version__ = '1.0.11' +__version__ = '1.0.31' __all__ = ['Case', 'Comment', 'Image', 'OrderInfo', 'PackSlipCustomInfo', 'Spoke', 'ValidationError', 'SpokeError'] @@ -296,16 +297,72 @@ def __init__(self, **kwargs): ''' _validate(kwargs, CaseId = Required(), - CaseType = Required(Enum('iph4bt', 'iph4tough', 'iph4tough2', 'iph3bt', - 'iph3tough', 'ipt4gbt', 'bb9900bt', 'kindlefirebt', 'ssgs3vibe', - 'iph5bt', 'iph5vibe', 'iph5cbt', 'iph5xtreme', 'iph6bt', - 'iph6tough', 'iph655bt', 'iph655tough', 'ipad4bt', 'ipadminitough', - 'ipt5gbt', 'ssgn2tough', 'bbz10tough', 'ssgs4bt', 'ssgs4vibe', - 'ssgs5bt', 'ssgn4bt', 'ssgs6vibe', 'ssgs6bt', 'ssgs7bt', 'iph6sbtpresale', - 'iph6stoughpresale', 'iph6splusbtpresale', 'iph6splustoughpresale', - 'iph7bt', 'iph7tough', 'iph7plusbt', 'iph7plustough', - 'mug11oz', 'mug15oz', 'mug12ozlatte', 'mug15oztravel', 'journal5x7blank', - 'journal5x7ruled', 'spiral6x8ruled', 'ssgs8bt', 'iph8bt', 'iph8tough')), + CaseType = Required(Enum( + 'bb9900bt', 'bbz10tough', 'kindlefirebt', + # apple / iphone + 'iph3bt', 'iph3tough', 'iph4bt', 'iph4tough', 'iph4tough2', + 'ipt4gbt', 'iph5bt', 'iph5vibe', 'iph5cbt', 'ipt5gbt', + 'iph5xtreme', 'iph6bt', 'iph6tough', 'iph655bt', 'iph655tough', + 'ipad4bt', 'ipadminitough', 'iph6sbtpresale', + 'iph6stoughpresale', 'iph6splusbtpresale', + 'iph6splustoughpresale', 'iph7bt', 'iph7tough', 'iph7plusbt', + 'iph7plustough', 'iph8bt', 'iph8tough', 'iph10bt', + 'iph10tough', 'iphxsmaxbt', 'iphxsmaxtough', 'iphxrbt', + 'iphxrtough', 'iph11bt', 'iph11tough', 'iph11probt', + 'iph11protough', 'iph11promaxbt', 'iph11promaxtough', + 'iph12minibt', 'iph12minitough', 'iph12probt', + 'iph12protough', 'iph12promaxbt', 'iph12promaxtough', + 'iph13bt', 'iph13tough', 'iph13minibt', 'iph13minitough', + 'iph13probt', 'iph13protough', 'iph13promaxbt', 'iph13promaxtough', + 'iph14snapps', 'iph14prosnapps', 'iph14plussnapps', 'iph14promaxsnapps', + 'iph14toughps', 'iph14protoughps', 'iph14plustoughps', 'iph14promaxtoughps', + 'SP10599', # iphone 15 slim + 'SP10603', # iphone 15 tough + 'SP10601', # iphone 15 plus slim + 'SP10605', # iphone 15 plus tough + 'SP10600', # iphone 15 pro slim + 'SP10604', # iphone 15 pro tough + 'SP10602', # iphone 15 pro max slim + 'SP10606', # iphone 15 pro max tough + 'SP10625', # iphone 16 slim + 'SP10629', # iphone 16 tough + 'SP10627', # iphone 16 plus slim + 'SP10631', # iphone 16 plus tough + 'SP10626', # iphone 16 pro slim + 'SP10630', # iphone 16 pro tough + 'SP10628', # iphone 16 pro max slim + 'SP10632', # iphone 16 pro max tough + 'SP10803', # iphone 17 slim + 'SP10815', # iphone 17 tough + 'SP10812', # iphone 17 pro slim + 'SP10824', # iphone 17 pro tough + 'SP10809', # iphone 17 pro max slim + 'SP10821', # iphone 17 pro max tough + 'SP10806', # iphone 17 air slim + 'SP10818', # iphone 17 air tough + # buttons + 'button-round-125', 'button-round-225', + # samsung / galaxy + 'ssgn2tough', 'ssgs3vibe', 'ssgs4bt', 'ssgs4vibe', + 'ssgs5bt', 'ssgn4bt', 'ssgs6vibe', 'ssgs6bt', 'ssgs7bt', 'ssgs8bt', + # magnets + '3x3-magnet', '4x4-magnet', '6x6-magnet', + # mugs + 'mug11oz', 'mug15oz', 'mug12ozlatte', 'mug15oztravel', + # notebooks + 'journal5x7blank', 'journal5x7ruled', 'spiral6x8ruled', + # stickers + '2x2-white', '3x3-white', '4x4-white', '6x6-white', + '2x2-clear', '3x3-clear', '4x4-clear', '6x6-clear', + # socks + 'sock-small', 'sock-medium', 'sock-large', + # face masks + 'facemasksmall', 'facemasklarge', + # puzzles + '8x10-puzzle', '11x14-puzzle', '16x20-puzzle', + # mouse pad / desk mat + '9x7mousepad', 'smallmat', 'largemat', 'xlargemat', + )), Quantity = Required(), PrintImage = Required(Image), QcImage = Optional(Image), @@ -409,7 +466,7 @@ def _generate_tree(self, tag_name, serializers, node): else: element = etree.Element(tag_name) - if not isinstance(node, basestring): + if not isinstance(node, str): node = str(node) element.text = node @@ -434,11 +491,11 @@ def serialize_it(tag_name, value): Key = self.Key, Order = Order, )) - return etree.tostring(request, pretty_print=True) + return etree.tostring(request, encoding='utf-8', pretty_print=True) def _send_request(self, request): res = self.transport.send(request) - tree = etree.fromstring(res) + tree = etree.fromstring(res.decode('utf-8')) result = tree.xpath('//result')[0].text if result == 'Success':