Skip to content
This repository was archived by the owner on Jan 4, 2025. It is now read-only.

added easyship api support for indian marketplace#169

Merged
GriceTurrble merged 7 commits intopython-amazon-mws:developfrom
KushGoyal:easyship
Jun 25, 2020
Merged

added easyship api support for indian marketplace#169
GriceTurrble merged 7 commits intopython-amazon-mws:developfrom
KushGoyal:easyship

Conversation

@KushGoyal
Copy link
Copy Markdown
Contributor

@KushGoyal KushGoyal commented Mar 24, 2020

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 24, 2020

Codecov Report

Merging #169 into develop will decrease coverage by 1.26%.
The diff coverage is 40.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #169      +/-   ##
===========================================
- Coverage    77.51%   76.25%   -1.27%     
===========================================
  Files           18       19       +1     
  Lines          965      998      +33     
  Branches        92       95       +3     
===========================================
+ Hits           748      761      +13     
- Misses         212      232      +20     
  Partials         5        5              
Impacted Files Coverage Δ
mws/__init__.py 100.00% <ø> (ø)
mws/apis/feeds.py 78.94% <16.66%> (-9.29%) ⬇️
mws/apis/easyship.py 40.74% <40.74%> (ø)
mws/apis/__init__.py 100.00% <100.00%> (ø)
mws/apis/orders.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 949538e...b1414a4. Read the comment docs.

@KushGoyal KushGoyal changed the title added easyship api support for indian marketplace added easyship api support for indian marketplace #162 Mar 25, 2020
@KushGoyal KushGoyal changed the title added easyship api support for indian marketplace #162 added easyship api support for indian marketplace Mar 25, 2020
@KushGoyal
Copy link
Copy Markdown
Contributor Author

Any update on merging this?

@Bobspadger
Copy link
Copy Markdown
Member

Any update on merging this?

Sorry, I've not had a chance to even think about looking at present. I'll try to give it a quick review this week sometime, as long as nothing else crops up!

Copy link
Copy Markdown
Member

@GriceTurrble GriceTurrble left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, this look solid to me, but there are some minor changes I would like to see before approval:

  1. Method name consistency (strict matching for method names and the MWS actions they cover).
  2. Argument name shortening and consistency (using slot_ in place of the more verbose package_slot_ prefix).
  3. Future-proofing the update_scheduled_packages (although Amazon only accepts one package per request, they have designed the call to take more than one; if they update their backend capabilities, we would be able to support it proactively with a change here).

Aside from those, good work, and thank you for the contribution. Please address the above and we'll get it merged into dev version shortly. :)

@GriceTurrble GriceTurrble mentioned this pull request May 2, 2020
@KushGoyal KushGoyal requested a review from GriceTurrble May 20, 2020 16:51
@KushGoyal
Copy link
Copy Markdown
Contributor Author

@GriceTurrble Hi, did you get a chance to review my code?

Comment on lines +65 to +69
detail['ScheduledPackageId.AmazonOrderId'] = detail.pop('amazon_order_id')
detail['ScheduledPackageId.PackageId'] = detail.pop('package_id')
detail['PackagePickupSlot.SlotId'] = detail.pop('slot_id')
detail['PackagePickupSlot.PickupTimeStart'] = detail.pop('slot_start_time', None)
detail['PackagePickupSlot.PickupTimeEnd'] = detail.pop('slot_end_time', None)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have minor doubts about this particular pattern, but not a showstopper. Changes will be accepted, and I encourage you to contribute an additional change with the following.


To be clear, this code does work as intended, even in a case where it doesn't seem like it should. For instance, if package_update_details is an immutable sequence, like a tuple, one might think it can't be updated. In fact, the dicts contained in the sequence can be updated, and the tuple that points to them is not being changed. Though this works, I would like to see it cleaned up so that we aren't changing an object as we iterate through it.

Further, if the detail inside the loop is not a dict, it will throw TypeError: string indices must be integers when trying to access one of its keys. That's not a clear error message for what actually happened, so I would like to see that error handled in a way that contextualizes the problem for the end user. For example:

if not isinstance(detail, dict):
    raise ValueError("Package details must be a list of dicts, each with required keys `amazon_order_id`, `package_id`, and `slot_id` (optional keys: `slot_start_time` and `slot_end_time`)")

Similarly, detail.pop('amazon_order_id') will throw KeyError: 'amazon_order_id' if that key is missing. Again, in context, this is a bit obscure, and we want the user to see some more details to help them out. Ideally, the dict should be tested for those required keys, with the same ValueError as above thrown if any are missing, so that the developer knows what went wrong more quickly.

These concerns can be handled by a utility function from elsewhere in the module.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GriceTurrble thanks for pointing this out. I will fix these points. The package_update_details won't be modified in the function. And the function will throw an error if a non dict or a dict without required keys is passed.

@GriceTurrble GriceTurrble merged commit 721b20c into python-amazon-mws:develop Jun 25, 2020
Lacrymology added a commit to Shiphero/python-amazon-mws that referenced this pull request Jul 10, 2020
* upstream/develop:
  Add Feeds utility to convert dict FeedOptions to string (python-amazon-mws#181)
  Ensure correct decoding of bytes (python-amazon-mws#168)
  Compatibility fix (python-amazon-mws#124)
  Implement a couple of function for the OutboundShipments API. (python-amazon-mws#96)
  Added OutboundShipments.create_fulfillment_order (python-amazon-mws#95)
  added UpdateReportAcknowledgements (python-amazon-mws#101)
  Update feeds.py (python-amazon-mws#166)
  added easyship api support for indian marketplace (python-amazon-mws#169)
  Moving Slack link up, removing gitter chat link
  add all current marketplaces and alphabetize by country code (python-amazon-mws#155)
  Updated slack invite link
  Slack invite link (python-amazon-mws#152)
  Slack invite link
  fix clean_params (python-amazon-mws#106)
  add in NL marketplace information
  Fix flake8 warnings
  Update develop branch CI + package metadata
  include mws.apis in setup.py
  Fix bug: Remove trailing comma
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants