Closed orchidinsanity closed 4 years ago
Hey. Thanks for filing the issue. I believe this is a problem with the metadata exposed by etsy. I sent an email asking them to fix this, but if I don't hear anything back I will implement a workaround for this method sometime between the 29th and 31st.. Sorry I can't unblock you immediately. More detailed description of the problem below if you care.
As you probably know, this library works by dynamically creating the api methods at runtime based on the metadata exposed by the etsy api. If you look at the method descriptions on the API you can see almost every method has the url parameters exposed as valid parameters in their description.
For example, look at "findAllShopReceiptsByStatus" on https://www.etsy.com/developers/documentation/reference/receipt. You can see there are two url params, shop_id and status, and they are listed in the parameters section immediately below the url.
Now look at "submitTracking" on the same page. You can see there are two url parameters on this method, shop_id and receipt_id, but neither are listed in the parameters section. This is the only example in the api I could find like this.
As these parameters aren't exposed in the metadata, the typechecker doesn't think they are valid when you pass them to the method. The correct way to fix this would be to have etsy add them to the metadata. If Etsy won't do this, then I will unfortunately have to make a special case for this method or potentially make url parameters behave differently than other params (makes parsing more complicated, but is probably the actual right solution.
Thanks for your help -- much appreciated. I did notice that no other method in the API requires two url parameters. Hopefully Etsy will get back to you soon, but if not, I'm sure your solution will work well.
On Sun, May 24, 2020 at 6:28 PM Sean Scheetz notifications@github.com wrote:
Hey. Thanks for filing the issue. I believe this is a problem with the metadata exposed by etsy. I sent an email asking them to fix this, but if I don't hear anything back I will implement a workaround for this method. Sorry I can't unblock you immediately. More detailed description of the problem below if you care.
As you probably know, this library works by dynamically creating the api methods at runtime based on the metadata exposed by the etsy api. If you look at the method descriptions on the API you can see almost every method has the url parameters exposed as valid parameters in their description.
For example, look at "findAllShopReceiptsByStatus" on https://www.etsy.com/developers/documentation/reference/receipt. You can see there are two url params, shop_id and status, and they are listed in the parameters section immediately below the url.
Now look at "submitTracking" on the same page. You can see there are two url parameters on this method, shop_id and receipt_id, but neither are listed in the parameters section. This is the only example in the api I could find like this.
As these parameters aren't exposed in the metadata, the typechecker doesn't think they are valid when you pass them to the method. The correct way to fix this would be to have etsy add them to the metadata. If Etsy won't do this, then I will unfortunately have to make a special case for this method.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sscheetz/etsy-python2/issues/5#issuecomment-633334261, or unsubscribe https://github.com/notifications/unsubscribe-auth/APWH3NCOKVOWIUYM4B2MD6DRTHCS7ANCNFSM4NISYRFA .
version 0.7.0 released on pypi should fix this. https://pypi.org/project/etsy2/0.7.0/
etsy said they couldn't fix quickly so had to add the hack. It's very tiny so should be okay.
included a change that made the url parameters work more correctly and made the python interface more consistent, but if you see any regressions and I will push a build to fix it asap. (by just including the hack and not the other changes).
Thanks for the patience :)
Thank you for your great work on Python etsy2. Through your work, I was FINALLY able to get through the OAuth process...
I have a question which I hope you can help me with, as it has stumped me for hours of searching and failed attempts as there are not yet many examples of etsy api Python usage to follow.
I am trying to use the submitTracking method to update an order with a USPS tracking number. Here is basically what I've tried:
etsy.submitTracking(receipt_id=1645916330,tracking_code='9400111298370137933799',carrier_name='usps',send_bcc=1)
which produces: Traceback (most recent call last): File "", line 1, in
File "/usr/local/lib/python3.7/site-packages/etsy2/_core.py", line 105, in call
return self.invoke(*args, kwargs)
File "/usr/local/lib/python3.7/site-packages/etsy2/_core.py", line 141, in invoke
self.type_checker(self.spec, kwargs)
File "/usr/local/lib/python3.7/site-packages/etsy2/_core.py", line 32, in call
raise ValueError('Unexpected argument: %s=%s' % (k, v))
ValueError: Unexpected argument: receipt_id=1645916330
So the submitTracking method, as I have entered it, does not recognize the receipt_id provided. From the etsy API page for the submitTracking method, it appears that both the shop_id and receipt_id must be provided:
I am unclear on how to format my command in Python to take my shop_id AND the receipt ID. I would be very, very grateful for any help you can provide on how to properly structure the submission for this submitTracking method, as I have not been able to find any clear-cut explanations on the web for an example to follow in Python.
Many thanks,
DYH