8000 InboundShipments, next_token_action decorator, and some style cleanups. by GriceTurrble · Pull Request #33 · python-amazon-mws/python-amazon-mws · GitHub
[go: up one dir, main page]

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

Conversation

@GriceTurrble
Copy link
Member
@GriceTurrble GriceTurrble commented Jan 12, 2018

This PR adds functionality for InboundShipments, as well as some utility methods:

  • enumerate_param, replacement for MWS.enumerate_param (deprecation warning added)
  • enumerate_params, a shortcut method that can run enumerate_param over multiple entries.
  • enumerate_keyed_param, allowing creating of enumerated commands with multiple items (enumerated) which have many data points per item (keyed).
  • next_token_action, a decorator for MWS request methods that streamlines management of "...ByNextToken" actions.

InboundShipments

Most of the methods here are similar to those of other classes, taking a set of arguments and submitting a request. Where this class differs is in the use of Fulfillment Inbound Shipments, aka "FBA" shipments. From experience, these calls - create_inbound_shipment_plan, create_inbound_shipment, etc. - require a complex set of data to be entered on each request. Some of this data is intended to be identical between subsequent requests, so there are some helper methods included.

set_ship_from_address

A "ship-from address" can be stored on the InboundShipments instance, such that any call to MWS that requires it will pass it automatically. This is passed to the set_ship_from_address method as a dict that expects the following keys, which are translated into their appropriate parameter for MWS:

  • Example: python_key -> MWSKey
  • name -> Name
  • address_1 -> AddressLine1
  • address_2 -> AddressLine2
  • city -> City
  • district_or_county -> DistrictOrCounty
  • state_or_province -> StateOrProvinceCode
  • postal_code -> PostalCode
  • country -> CountryCode

Only name, address_1, and city are technically required: others are optional, but MWS may return its own errors if some mix of data is missing. This method will throw MWSError if one of the required keys is missing, and will print out the list of required and optional keys in the process.

The class can be instantiated with a ship-from address automatically using:

inbound = InboundShipment(..., from_address=address)

where address is a dict with the above structure.

_parse_item_args

For actions that use enumerated-keyed parameters for items - such as create_inbound_shipment_plan and update_inbound_shipment - those items are passed to the appropriate request method as a list of dicts. Each dict in the list should contain keys such as:

  • sku -> SellerSKU
  • quantity -> Quantity or QuantityShipped (switches as needed)
  • quantity_in_case -> QuantityInCase
  • asin -> ASIN
  • condition -> Condition

Please refer to MWS documentation for additional details.


Enumerated Param(s) and Keyed Params

Original code features MWS.enumerate_param, which works but is limited. This PR features a re-worked version of that method, which has moved to the utils module (since it does not need to access MWS data directly).

The original method is still in place, as an alias for the newer one. The old method will also raise a DeprecationWarning noting the change.

In addition, there are two new methods, enumerate_params and enumerate_keyed_params.

enumerate_params

This functions similar to enumerate_param, but allows passing multiple key-value sets for enumeration. Pass it a dict where each key is a param to enumerate, and each key is a list, set, or tuple of values to enumerate under that param. With this, request functions with multiple enumerated params can make a single call to enumerate_params to process everything at once.

enumerate_keyed_params

For calls that require items to be keyed with additional data points per item - such as lists of SKUs and quantities sent through create_inbound_shipment_plan - this method enumerates each item and adds the appropriate key for its data points. See the example in code for details.


Next Token Action Decorator

Finally, the decorator utils.next_token_action provides a simple way to add "...ByNextToken" functionality to a given method. Rather than writing a separate method for the next token call, decorated request methods can be given a single next_token kwarg, which will run the appropriate action through the singular (new) method MWS.action_by_next_token.

As an additional check, the action name must be listed in the NEXT_TOKEN_OPERATIONS constant within that request's class. If not, action_by_next_token will throw MWSError. (While this part is not strictly necessary and can be stripped out of the code, I felt it best to double-check I was using the right request method, rather than attempt to send an illegitimate request to MWS by mistake.)

To use the decorator, add it to the request method with the name of the action related to it:

@utils.next_token_action('ListMarketplaceParticipations')
def list_marketplace_participations(self, next_token=None): # pylint: disable=unused-argument
    ...

With that set, the following calls are both valid:

sellers = Sellers(...)
response = sellers.list_marketplace_participation()
# Gets initial response data, which may include a `NextToken` key.
# Say we'll store that token in `token`:

response = sellers.list_marketplace_participation(next_token=token)
# Gets the next response from the previous call.

Note: next_token is not a required argument for the original method, but adding it can help clear up downstream issues, such as linters complaining that the next_token argument does not exist.

I also highly recommend setting defaults for each argument in the function signature, regardless if the argument is optional or not. This avoids an issue where linters complain that a positional argument is missing, when in fact it is not required for the next_token call.

In this PR, the decorator has been applied to every request method already present that might need it. Existing methods ending in by_next_token have been changed to aliases pointing to the original method, passing the next_token in.

@codecov
Copy link
codecov bot commented Jan 12, 2018

Codecov Report

Merging #33 into master will decrease coverage by 3.68%.
The diff coverage is 36.18%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #33      +/-   ##
==========================================
- Coverage   48.85%   45.16%   -3.69%     
==========================================
  Files           4        4              
  Lines         393      600     +207     
  Branches       22       64      +42     
==========================================
+ Hits          192      271      +79     
- Misses        192      314     +122     
- Partials        9       15       +6
Impacted Files Coverage Δ
mws/mws.py 42.73% <26.05%> (-9.26%) ⬇️
mws/utils.py 71.28% <72.72%> (+9.02%) ⬆️

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 e7fdc94...4dd6e31. Read the comment docs.

@GriceTurrble
Copy link
Member Author
GriceTurrble commented Jan 12, 2018

Last few commits just due to TravisCI failing due to some comments going over line length limits, mainly pylint disable flags. I've taken those out now.

As for coverage, I see there's not many tests in the project for the request methods, anyway. I figure trying to run that testing will necessarily fail, since that would require a seller connection.

I propose setting up some tests in which we're looking to see if the generated request string matches expectations. That might require some adjustment to the request methods to allow them to return the request string directly, and not actually execute that request on the backend; and then use tests to validate those strings. I'll leave that alone for the time being, though.

When I get some time, I'll write some tests for the methods I've added so far, such as enumerate_params.

@GriceTurrble GriceTurrble changed the base branch from master to develop January 23, 2018 02:40
@codecov-io
Copy link
codecov-io commented Jan 23, 2018

Codecov Report

Merging #33 into develop will decrease coverage by 3.49%.
The diff coverage is 37.14%.

Impacted file tree graph

@@            Coverage Diff            @@
##           develop     #33     +/-   ##
=========================================
- Coverage       50%   46.5%   -3.5%     
=========================================
  Files            4       4             
  Lines          418     630    +212     
  Branches        22      64     +42     
=========================================
+ Hits           209     293     +84     
- Misses         200     324    +124     
- Partials         9      13      +4
Impacted Files Coverage Δ
mws/mws.py 44.6% <27.71%> (-8.61%) ⬇️
mws/utils.py 71.28% <72.72%> (+9.02%) ⬆️

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 68eaf31...215d660. Read the comment docs.

@GriceTurrble GriceTurrble merged commit 2a768e7 into python-amazon-mws:develop Jan 23, 2018
@GriceTurrble GriceTurrble mentioned this pull request Jan 29, 2018
GriceTurrble added a commit that referenced this pull request Feb 4, 2018
* Added Finances API Feature

* .setup.py: bump version to 0.7.5-dev0

* Split out request_description building from make_request()

So that it can be tested more easily, and refactored

* Split out building the initial params dict from make_request()

So that it can be tested more easily

* Add fake MWS credentials pytest fixture

* test_service_status() should use the pytest fake credentials fixture

* Add more pytest fixtures (access_key, secret_key, account_id, timestamp)

* Add test for calc_request_description()

* Split out calc_request_description() into more statements

So that it is easier to debug

* Fix calc_request_description - don't include leading ampersand

* Don't do automated deployments via Travis (for the moment)

* Update README.md badges

* InboundShipments, next_token_action decorator, and some style cleanups. (#33)

* Testing out git commits from VS Code

* Reverting the test commit

* Adding VS Code settings to gitignore.

* Style fixes

* MWS.enumerate_param deprecated: now using utils.enumerate_param and utils.enumerate_params

* InboundShipments fleshed out; added `utils.next_token_action` decorator; deprecated separate methods for `...by_next_token()`

* Bugfix, rename `_enumerate_param` to `enumerate_param` (no need for private)

* Fix for next_token issues.

* TravisCI flake8 complaining, fixes.

* Minor flake8 complaint.

* Hack to get flake8 to stop complaining.

* Strip pylint disables to clear line length issue.

* Correction to keyed params, now tests every item in values sequence to ensure all are dicts.

* Add tests for param methods in utils.

* Add test for next token decorator.

* Adding 'InboundShipments' to `__all__`

* Assigning response a default in __init__ for DictWrapper and DataWrapper

* Unneeded line breaks removed + docstring formatting

* Comment corrected. They're tuples, not sets.

* Finances methods updated to use next_token_action decorator

* Create .travis.yaml

* Update .gitignore

* Removing deploy code from local travis

* Delete .travis.yaml

* Pushed to 0.8.0-dev0

Recently added functionality to InboundShipments, as well as Finances API. These constitute feature additions with backwards compatibility, which calls for a minor version update.

* Adding Python 3.6 category

We are testing in 3.6 in Travis anyway. May as well include the note.

* Specified master and develop branches for badges

Ensured the badges for Travis and Codecov are pointing to the appropriate branches (used to be pointing to default, which was master in both cases).

* Updated comments throughout module

No substantial code changes, comment changes only. Also ensured all docstrings follow same format.

* Fixed docstring formatting

Also made slight update to docstring for ObjectDict to more clearly note what it does, vs what the original code did.

* Fix for flake8 (trailing whitespace)

* Fix for flake8 (trailing whitespace)

* Bump to 0.8.0 (drop dev tag) for release

* Bug: Incorrect use of `super` for back-compat

Using the old-style `super` syntax to comply with Python 2.7 compatibility. Not revealed in tests, because current tests don't touch the APIs. Whoops!

* Added back old object names in case needed

Old names `object_dict` and `xml2dict` added back in case the old objects are being used directly by some users.

To be removed in 1.0.0 release down the road.
GriceTurrble added a commit that referenced this pull request Feb 6, 2018
* Merge recent changes from upstream. (#1)

* Added Finances API Feature

* Don't do automated deployments via Travis (for the moment)

* Update README.md badges

* InboundShipments, next_token_action decorator, and some style cleanups. (#33)

* Testing out git commits from VS Code

* Reverting the test commit

* Adding VS Code settings to gitignore.

* Style fixes

* MWS.enumerate_param deprecated: now using utils.enumerate_param and utils.enumerate_params

* InboundShipments fleshed out; added `utils.next_token_action` decorator; deprecated separate methods for `...by_next_token()`

* Bugfix, rename `_enumerate_param` to `enumerate_param` (no need for private)

* Fix for next_token issues.

* TravisCI flake8 complaining, fixes.

* Minor flake8 complaint.

* Hack to get flake8 to stop complaining.

* Strip pylint disables to clear line length issue.

* Correction to keyed params, now tests every item in values sequence to ensure all are dicts.

* Add tests for param methods in utils.

* Add test for next token decorator.

* Adding 'InboundShipments' to `__all__`

* Assigning response a default in __init__ for DictWrapper and DataWrapper

* Unneeded line breaks removed + docstring formatting

* Comment corrected. They're tuples, not sets.

* Finances methods updated to use next_token_action decorator

* Ignore VS Code settings

* Remove unneeded spacing

* Add __iter__ method for ObjectDict to allow simpler iteration, without having a problem when the node is a single ObjectDict instead of a list.

* Update docstring for `fromstring`

* Variable name correction (linter complaint)

* Comment and docstring overhaul

* Remove get_timestamp, replace with more standard datetime.datetime.utcnow().isoformat()

* Add `assert_no_token` test for methods that use a next_token.

* Rename _parse_item_args to parse_item_args (no need for it to be "private")

* Re-write for calc_request_description to make some more sense.

* Set up testing flag for params to request method.

* Test name and comment cleanup

* Contents of __all__ sorted alphabetically (pet peeve)

* Include assert_no_token as part of decorator test

* Add initial modules for testing request methods

* rename test modules (linter complaint)

* Inventory tests added.

* Remove independent service status test (moving towards shared service status param test for each class)

* Move service status test to tests.utils.CommonTests, to be inherited by each request test case from here on.

* Set isoformat timespec to seconds (don't explicitly need milliseconds, and omitting them makes testing simpler)

* Refining common tests, using Inventory class to test the tests.

* Bug: should not change the test param to false.

* Bugfix: timespec is only available in 3.6+.  Replacing with microsecond=0 solution to produce desired result.

* Stubs for test suites for existing APIs

* Docstrings. Docstrings everywhere.

* Bugfix: incorrect super for 2.7

* Documentation updated with gettingStarted section
GriceTurrble added a commit that referenced this pull request Feb 6, 2018
* Release for 0.8.0 (#42)

* Added Finances API Feature

* .setup.py: bump version to 0.7.5-dev0

* Split out request_description building from make_request()

So that it can be tested more easily, and refactored

* Split out building the initial params dict from make_request()

So that it can be tested more easily

* Add fake MWS credentials pytest fixture

* test_service_status() should use the pytest fake credentials fixture

* Add more pytest fixtures (access_key, secret_key, account_id, timestamp)

* Add test for calc_request_description()

* Split out calc_request_description() into more statements

So that it is easier to debug

* Fix calc_request_description - don't include leading ampersand

* Don't do automated deployments via Travis (for the moment)

* Update README.md badges

* InboundShipments, next_token_action decorator, and some style cleanups. (#33)

* Testing out git commits from VS Code

* Reverting the test commit

* Adding VS Code settings to gitignore.

* Style fixes

* MWS.enumerate_param deprecated: now using utils.enumerate_param and utils.enumerate_params

* InboundShipments fleshed out; added `utils.next_token_action` decorator; deprecated separate methods for `...by_next_token()`

* Bugfix, rename `_enumerate_param` to `enumerate_param` (no need for private)

* Fix for next_token issues.

* TravisCI flake8 complaining, fixes.

* Minor flake8 complaint.

* Hack to get flake8 to stop complaining.

* Strip pylint disables to clear line length issue.

* Correction to keyed params, now tests every item in values sequence to ensure all are dicts.

* Add tests for param methods in utils.

* Add test for next token decorator.

* Adding 'InboundShipments' to `__all__`

* Assigning response a default in __init__ for DictWrapper and DataWrapper

* Unneeded line breaks removed + docstring formatting

* Comment corrected. They're tuples, not sets.

* Finances methods updated to use next_token_action decorator

* Create .travis.yaml

* Update .gitignore

* Removing deploy code from local travis

* Delete .travis.yaml

* Pushed to 0.8.0-dev0

Recently added functionality to InboundShipments, as well as Finances API. These constitute feature additions with backwards compatibility, which calls for a minor version update.

* Adding Python 3.6 category

We are testing in 3.6 in Travis anyway. May as well include the note.

* Specified master and develop branches for badges

Ensured the badges for Travis and Codecov are pointing to the appropriate branches (used to be pointing to default, which was master in both cases).

* Updated comments throughout module

No substantial code changes, comment changes only. Also ensured all docstrings follow same format.

* Fixed docstring formatting

Also made slight update to docstring for ObjectDict to more clearly note what it does, vs what the original code did.

* Fix for flake8 (trailing whitespace)

* Fix for flake8 (trailing whitespace)

* Bump to 0.8.0 (drop dev tag) for release

* Bug: Incorrect use of `super` for back-compat

Using the old-style `super` syntax to comply with Python 2.7 compatibility. Not revealed in tests, because current tests don't touch the APIs. Whoops!

* Added back old object names in case needed

Old names `object_dict` and `xml2dict` added back in case the old objects are being used directly by some users.

To be removed in 1.0.0 release down the road.

* Version bump for agent string.

* Hi, howyadoin?

* Format request url with str.format

Remove old-style string formatting for sake of clarity.
GriceTurrble added a commit that referenced this pull request Feb 6, 2018
* Release for 0.8.0 (#42)

* Added Finances API Feature

* .setup.py: bump version to 0.7.5-dev0

* Split out request_description building from make_request()

So that it can be tested more easily, and refactored

* Split out building the initial params dict from make_request()

So that it can be tested more easily

* Add fake MWS credentials pytest fixture

* test_service_status() should use the pytest fake credentials fixture

* Add more pytest fixtures (access_key, secret_key, account_id, timestamp)

* Add test for calc_request_description()

* Split out calc_request_description() into more statements

So that it is easier to debug

* Fix calc_request_description - don't include leading ampersand

* Don't do automated deployments via Travis (for the moment)

* Update README.md badges

* InboundShipments, next_token_action decorator, and some style cleanups. (#33)

* Testing out git commits from VS Code

* Reverting the test commit

* Adding VS Code settings to gitignore.

* Style fixes

* MWS.enumerate_param deprecated: now using utils.enumerate_param and utils.enumerate_params

* InboundShipments fleshed out; added `utils.next_token_action` decorator; deprecated separate methods for `...by_next_token()`

* Bugfix, rename `_enumerate_param` to `enumerate_param` (no need for private)

* Fix for next_token issues.

* TravisCI flake8 complaining, fixes.

* Minor flake8 complaint.

* Hack to get flake8 to stop complaining.

* Strip pylint disables to clear line length issue.

* Correction to keyed params, now tests every item in values sequence to ensure all are dicts.

* Add tests for param methods in utils.

* Add test for next token decorator.

* Adding 'InboundShipments' to `__all__`

* Assigning response a default in __init__ for DictWrapper and DataWrapper

* Unneeded line breaks removed + docstring formatting

* Comment corrected. They're tuples, not sets.

* Finances methods updated to use next_token_action decorator

* Create .travis.yaml

* Update .gitignore

* Removing deploy code from local travis

* Delete .tr
6D40
avis.yaml

* Pushed to 0.8.0-dev0

Recently added functionality to InboundShipments, as well as Finances API. These constitute feature additions with backwards compatibility, which calls for a minor version update.

* Adding Python 3.6 category

We are testing in 3.6 in Travis anyway. May as well include the note.

* Specified master and develop branches for badges

Ensured the badges for Travis and Codecov are pointing to the appropriate branches (used to be pointing to default, which was master in both cases).

* Updated comments throughout module

No substantial code changes, comment changes only. Also ensured all docstrings follow same format.

* Fixed docstring formatting

Also made slight update to docstring for ObjectDict to more clearly note what it does, vs what the original code did.

* Fix for flake8 (trailing whitespace)

* Fix for flake8 (trailing whitespace)

* Bump to 0.8.0 (drop dev tag) for release

* Bug: Incorrect use of `super` for back-compat

Using the old-style `super` syntax to comply with Python 2.7 compatibility. Not revealed in tests, because current tests don't touch the APIs. Whoops!

* Added back old object names in case needed

Old names `object_dict` and `xml2dict` added back in case the old objects are being used directly by some users.

To be removed in 1.0.0 release down the road.

* Version bump for agent string.

* Hi, howyadoin?

* Format request url with str.format

Remove old-style string formatting for sake of clarity.
GriceTurrble added a commit that referenced this pull request Feb 6, 2018
* Release for 0.8.0 (#42)

* Added Finances API Feature

* .setup.py: bump version to 0.7.5-dev0

* Split out request_description building from make_request()

So that it can be tested more easily, and refactored

* Split out building the initial params dict from make_request()

So that it can be tested more easily

* Add fake MWS credentials pytest fixture

* test_service_status() should use the pytest fake credentials fixture

* Add more pytest fixtures (access_key, secret_key, account_id, timestamp)

* Add test for calc_request_description()

* Split out calc_request_description() into more statements

So that it is easier to debug

* Fix calc_request_description - don't include leading ampersand

* Don't do automated deployments via Travis (for the moment)

* Update README.md badges

* InboundShipments, next_token_action decorator, and some style cleanups. (#33)

* Testing out git commits from VS Code

* Reverting the test commit

* Adding VS Code settings to gitignore.

* Style fixes

* MWS.enumerate_param deprecated: now using utils.enumerate_param and utils.enumerate_params

* InboundShipments fleshed out; added `utils.next_token_action` decorator; deprecated separate methods for `...by_next_token()`

* Bugfix, rename `_enumerate_param` to `enumerate_param` (no need for private)

* Fix for next_token issues.

* TravisCI flake8 complaining, fixes.

* Minor flake8 complaint.

* Hack to get flake8 to stop complaining.

* Strip pylint disables to clear line length issue.

* Correction to keyed params, now tests every item in values sequence to ensure all are dicts.

* Add tests for param methods in utils.

* Add test for next token decorator.

* Adding 'InboundShipments' to `__all__`

* Assigning response a default in __init__ for DictWrapper and DataWrapper

* Unneeded line breaks removed + docstring formatting

* Comment corrected. They're tuples, not sets.

* Finances methods updated to use next_token_action decorator

* Create .travis.yaml

* Update .gitignore

* Removing deploy code from local travis

* Delete .travis.yaml

* Pushed to 0.8.0-dev0

Recently added functionality to InboundShipments, as well as Finances API. These constitute feature additions with backwards compatibility, which calls for a minor version update.

* Adding Python 3.6 category

We are testing in 3.6 in Travis anyway. May as well include the note.

* Specified master and develop branches for badges

Ensured the badges for Travis and Codecov are pointing to the appropriate branches (used to be pointing to default, which was master in both cases).

* Updated comments throughout module

No substantial code changes, comment changes only. Also ensured all docstrings follow same format.

* Fixed docstring formatting

Also made slight update to docstring for ObjectDict to more clearly note what it does, vs what the original code did.

* Fix for flake8 (trailing whitespace)

* Fix for flake8 (trailing whitespace)

* Bump to 0.8.0 (drop dev tag) for release

* Bug: Incorrect use of `super` for back-compat

Using the old-style `super` syntax to comply with Python 2.7 compatibility. Not revealed in tests, because current tests don't touch the APIs. Whoops!

* Added back old object names in case needed

Old names `object_dict` and `xml2dict` added back in case the old objects are being used directly by some users.

To be removed in 1.0.0 release down the road.

* Version bump for agent string.

* Hi, howyadoin?

* Format request url with str.format

Remove old-style string formatting for sake of clarity.
GriceTurrble pushed a commit that referenced this pull request Mar 10, 2018
* Release for 0.8.0 (#42)

* Added Finances API Feature

* .setup.py: bump version to 0.7.5-dev0

* Split out request_description building from make_request()

So that it can be tested more easily, and refactored

* Split out building the initial params dict from make_request()

So that it can be tested more easily

* Add fake MWS credentials pytest fixture

* test_service_status() should use the pytest fake credentials fixture

* Add more pytest fixtures (access_key, secret_key, account_id, timestamp)

* Add test for calc_request_description()

* Split out calc_request_description() into more statements

So that it is easier to debug

* Fix calc_request_description - don't include leading ampersand

* Don't do automated deployments via Travis (for the moment)

* Update README.md badges

* InboundShipments, next_token_action decorator, and some style cleanups. (#33)

* Testing out git commits from VS Code

* Reverting the test commit

* Adding VS Code settings to gitignore.

* Style fixes

* MWS.enumerate_param deprecated: now using utils.enumerate_param and utils.enumerate_params

* InboundShipments fleshed out; added `utils.next_token_action` decorator; deprecated separate methods for `...by_next_token()`

* Bugfix, rename `_enumerate_param` to `enumerate_param` (no need for private)

* Fix for next_token issues.

* TravisCI flake8 complaining, fixes.

* Minor flake8 complaint.

* Hack to get flake8 to stop complaining.

* Strip pylint disables to clear line length issue.

* Correction to keyed params, now tests every item in values sequence to ensure all are dicts.

* Add tests for param methods in utils.

* Add test for next token decorator.

* Adding 'InboundShipments' to `__all__`

* Assigning response a default in __init__ for DictWrapper and DataWrapper

* Unneeded line breaks removed + docstring formatting

* Comment corrected. They're tuples, not sets.

* Finances methods updated to use next_token_action decorator

* Create .travis.yaml

* Update .gitignore

* Removing deploy code from local travis

* Delete .travis.yaml

* Pushed to 0.8.0-dev0

Recently added functionality to InboundShipments, as well as Finances API. These constitute feature additions with backwards compatibility, which calls for a minor version update.

* Adding Python 3.6 category

We are testing in 3.6 in Travis anyway. May as well include the note.

* Specified master and develop branches for badges

Ensured the badges for Travis and Codecov are pointing to the appropriate branches (used to be pointing to default, which was master in both cases).

* Updated comments throughout module

No substantial code changes, comment changes only. Also ensured all docstrings follow same format.

* Fixed docstring formatting

Also made slight update to docstring for ObjectDict to more clearly note what it does, vs what the original code did.

* Fix for flake8 (trailing whitespace)

* Fix for flake8 (trailing whitespace)

* Bump to 0.8.0 (drop dev tag) for release

* Bug: Incorrect use of `super` for back-compat

Using the old-style `super` syntax to comply with Python 2.7 compatibility. Not revealed in tests, because current tests don't touch the APIs. Whoops!

* Added back old object names in case needed

Old names `object_dict` and `xml2dict` added back in case the old objects are being used directly by some users.

To be removed in 1.0.0 release down the road.

* Version bump for agent string.

* Hi, howyadoin?

* Format request url with str.format

Remove old-style string formatting for sake of clarity.

* Build new dict keyed param

* Initialized Merchant Fulfillment feature

* Merchant Fulfillment API methods

* Corrections for flake8 build errors

* Iterate over XML elements updated

* Fix item list format in MerchantFulfillment methods
GriceTurrble pushed a commit that referenced this pull request Mar 10, 2018
* Release for 0.8.0 (#42)

* Added Finances API Feature

* .setup.py: bump version to 0.7.5-dev0

* Split out request_description building from make_request()

So that it can be tested more easily, and refactored

* Split out building the initial params dict from make_request()

So that it can be tested more easily

* Add fake MWS credentials pytest fixture

* test_service_status() should use the pytest fake credentials fixture

* Add more pytest fixtures (access_key, secret_key, account_id, timestamp)

* Add test for calc_request_description()

* Split out calc_request_description() into more statements

So that it is easier to debug

* Fix calc_request_description - don't include leading ampersand

* Don't do automated deployments via Travis (for the moment)

* Update README.md badges

* InboundShipments, next_token_action decorator, and some style cleanups. (#33)

* Testing out git commits from VS Code

* Reverting the test commit

* Adding VS Code settings to gitignore.

* Style fixes

* MWS.enumerate_param deprecated: now using utils.enumerate_param and utils.enumerate_params

* InboundShipments fleshed out; added `utils.next_token_action` decorator; deprecated separate methods for `...by_next_token()`

* Bugfix, rename `_enumerate_param` to `enumerate_param` (no need for private)

* Fix for next_token issues.

* TravisCI flake8 complaining, fixes.

* Minor flake8 complaint.

* Hack to get flake8 to stop complaining.

* Strip pylint disables to clear line length issue.

* Correction to keyed params, now tests every item in values sequence to ensure all are dicts.

* Add tests for param methods in utils.

* Add test for next token decorator.

* Adding 'InboundShipments' to `__all__`

* Assigning response a default in __init__ for DictWrapper and DataWrapper

* Unneeded line breaks removed + docstring formatting

* Comment corrected. They're tuples, not sets.

* Finances methods updated to use next_token_action decorator

* Create .travis.yaml

* Update .gitignore

* Removing deploy code from local travis

* Delete .travis.yaml

* Pushed to 0.8.0-dev0

Recently added functionality to InboundShipments, as well as Finances API. These constitute feature additions with backwards compatibility, which calls for a minor version update.

* Adding Python 3.6 category

We are testing in 3.6 in Travis anyway. May as well include the note.

* Specified master and develop branches for badges

Ensured the badges for Travis and Codecov are pointing to the appropriate branches (used to be pointing to default, which was master in both cases).

* Updated comments throughout module

No substantial code changes, comment changes only. Also ensured all docstrings follow same format.

* Fixed docstring formatting

Also made slight update to docstring for ObjectDict to more clearly note what it does, vs what the original code did.

* Fix for flake8 (trailing whitespace)

* Fix for flake8 (trailing whitespace)

* Bump to 0.8.0 (drop dev tag) for release

* Bug: Incorrect use of `super` for back-compat

Using the old-style `super` syntax to comply with Python 2.7 compatibility. Not revealed in tests, because current tests don't touch the APIs. Whoops!

* Added back old object names in case needed

Old names `object_dict` and `xml2dict` added back in case the old objects are being used directly by some users.

To be removed in 1.0.0 release down the road.

* Version bump for agent string.

* Hi, howyadoin?

* Format request url with str.format

Remove old-style string formatting for sake of clarity.

* Build new dict keyed param

* Initialized Merchant Fulfillment feature

* Merchant Fulfillment API methods

* Corrections for flake8 build errors

* Iterate over XML elements updated

* Fix item list format in MerchantFulfillment methods

* Update unsafe parameters for new merchant services

https://docs.python.org/3/tutorial/controlflow.html#default-argument-values

* pylint tidy

* fix flake8 issues on CI
GriceTurrble added a commit that referenced this pull request Mar 10, 2018
* Merge recent changes in master to develop branch (#45) (#47)

* Release for 0.8.0 (#42)

* Added Finances API Feature

* .setup.py: bump version to 0.7.5-dev0

* Split out request_description building from make_request()

So that it can be tested more easily, and refactored

* Split out building the initial params dict from make_request()

So that it can be tested more easily

* Add fake MWS credentials pytest fixture

* test_service_status() should use the pytest fake credentials fixture

* Add more pytest fixtures (access_key, secret_key, account_id, timestamp)

* Add test for calc_request_description()

* Split out calc_request_description() into more statements

So that it is easier to debug

* Fix calc_request_description - don't include leading ampersand

* Don't do automated deployments via Travis (for the moment)

* Update README.md badges

* InboundShipments, next_token_action decorator, and some style cleanups. (#33)

* Testing out git commits from VS Code

* Reverting the test commit

* Adding VS Code settings to gitignore.

* Style fixes

* MWS.enumerate_param deprecated: now using utils.enumerate_param and utils.enumerate_params

* InboundShipments fleshed out; added `utils.next_token_action` decorator; deprecated separate methods for `...by_next_token()`

* Bugfix, rename `_enumerate_param` to `enumerate_param` (no need for private)

* Fix for next_token issues.

* TravisCI flake8 complaining, fixes.

* Minor flake8 complaint.

* Hack to get flake8 to stop complaining.

* Strip pylint disables to clear line length issue.

* Correction to keyed params, now tests every item in values sequence to ensure all are dicts.

* Add tests for param methods in utils.

* Add test for next token decorator.

* Adding 'InboundShipments' to `__all__`

* Assigning response a default in __init__ for DictWrapper and DataWrapper

* Unneeded line breaks removed + docstring formatting

* Comment corrected. They're tuples, not sets.

* Finances methods updated to use next_token_action decorator

* Create .travis.yaml

* Update .gitignore

* Removing deploy code from local travis

* Delete .travis.yaml

* Pushed to 0.8.0-dev0

Recently added functionality to InboundShipments, as well as Finances API. These constitute feature additions with backwards compatibility, which calls for a minor version update.

* Adding Python 3.6 category

We are testing in 3.6 in Travis anyway. May as well include the note.

* Specified master and develop branches for badges

Ensured the badges for Travis and Codecov are pointing to the appropriate branches (used to be pointing to default, which was master in both cases).

* Updated comments throughout module

No substantial code changes, comment changes only. Also ensured all docstrings follow same format.

* Fixed docstring formatting

Also made slight update to docstring for ObjectDict to more clearly note what it does, vs what the original code did.

* Fix for flake8 (trailing whitespace)

* Fix for flake8 (trailing whitespace)

* Bump to 0.8.0 (drop dev tag) for release

* Bug: Incorrect use of `super` for back-compat

Using the old-style `super` syntax to comply with Python 2.7 compatibility. Not revealed in tests, because current tests don't touch the APIs. Whoops!

* Added back old object names in case needed

Old names `object_dict` and `xml2dict` added back in case the old objects are being used directly by some users.

To be removed in 1.0.0 release down the road.

* Version bump for agent string.

* Hi, howyadoin?

* Format request url with str.format

Remove old-style string formatting for sake of clarity.

* Refactor timestamp method.

* Naming cleanups

* Single-source package version for use in agent string.

* MWS refactored, split into different modules.

* Version bump for feature

* Move and incorporate new MerchantFulfillment API

* merge artifacts removed [broken]

* Methods from PR #22 added.

* Changes from PR #53 merged
Bobspadger added a commit to Bobspadger/python-amazon-mws that referenced this pull request Mar 7, 2019
* Release for 0.8.0 (python-amazon-mws#42)

* Added Finances API Feature

* .setup.py: bump version to 0.7.5-dev0

* Split out request_description building from make_request()

So that it can be tested more easily, and refactored

* Split out building the initial params dict from make_request()

So that it can be tested more easily

* Add fake MWS credentials pytest fixture

* test_service_status() should use the pytest fake credentials fixture

* Add more pytest fixtures (access_key, secret_key, account_id, timestamp)

* Add test for calc_request_description()

* Split out calc_request_description() into more statements

So that it is easier to debug

* Fix calc_request_description - don't include leading ampersand

* Don't do automated deployments via Travis (for the moment)

* Update README.md badges

* InboundShipments, next_token_action decorator, and some style cleanups. (python-amazon-mws#33)

* Testing out git commits from VS Code

* Reverting the test commit

* Adding VS Code settings to gitignore.

* Style fixes

* MWS.enumerate_param deprecated: now using utils.enumerate_param and utils.enumerate_params

* InboundShipments fleshed out; added `utils.next_token_action` decorator; deprecated separate methods for `...by_next_token()`

* Bugfix, rename `_enumerate_param` to `enumerate_param` (no need for private)

* Fix for next_token issues.

* TravisCI flake8 complaining, fixes.

* Minor flake8 complaint.

* Hack to get flake8 to stop complaining.

* Strip pylint disables to clear line length issue.

* Correction to keyed params, now tests every item in values sequence to ensure all are dicts.

* Add tests for param methods in utils.

* Add test for next token decorator.

* Adding 'InboundShipments' to `__all__`

* Assigning response a default in __init__ for DictWrapper and DataWrapper

* Unneeded line breaks removed + docstring formatting

* Comment corrected. They're tuples, not sets.

* Finances methods updated to use next_token_action decorator

* Create .travis.yaml

* Update .gitignore

* Removing deploy code from local travis

* Delete .travis.yaml

* Pushed to 0.8.0-dev0

Recently added functionality to InboundShipments, as well as Finances API. These constitute feature additions with backwards compatibility, which calls for a minor version update.

* Adding Python 3.6 category

We are testing in 3.6 in Travis anyway. May as well include the note.

* Specified master and develop branches for badges

Ensured the badges for Travis and Codecov are pointing to the appropriate branches (used to be pointing to default, which was master in both cases).

* Updated comments throughout module

No substantial code changes, comment changes only. Also ensured all docstrings follow same format.

* Fixed docstring formatting

Also made slight update to docstring for ObjectDict to more clearly note what it does, vs what the original code did.

* Fix for flake8 (trailing whitespace)

* Fix for flake8 (trailing whitespace)

* Bump to 0.8.0 (drop dev tag) for release

* Bug: Incorrect use of `super` for back-compat

Using the old-style `super` syntax to comply with Python 2.7 compatibility. Not revealed in tests, because current tests don't touch the APIs. Whoops!

* Added back old object names in case needed

Old names `object_dict` and `xml2dict` added back in case the old objects are being used directly by some users.

To be removed in 1.0.0 release down the road.

* Version bump for agent string.

* Hi, howyadoin?

* Format request url with str.format

Remove old-style string formatting for sake of clarity.

* BUG: GetReportList missing from next token ops

Added in with a hotfix.

* Version push

* version push

* version bump (corrects wrong version from before)

* Bugfix inbound constructor (0.8.3 release) (python-amazon-mws#57)

* version bump

* No from_address assignment needed in Inbound init

Similar fix as commit on `develop`, which will come in with 1.0 release.

Also, version bump for new bugfix release.

* Remove import for ExpatError

We do not support Python < 2.7, in which ParseError is available; import for ExpatError is not necessary.

* Comments added for later work.

* Added '.' at end of some params to test

Params ought to pass through `enumerate_keyed_param` whether they end with '.' or not.

* Added test for dict_keyed_params

* Added test for enumerate_keyed_param

Also fix the existing one (wrong info used)

* Convert test methods to testcase class

* Create example_response.txt

File contains an example response from MWS, taken directly from MWS documentation. To be used for testing utilities.

* Change test methods to test case classes

* Add `download_url` to setup.py

* Fix issue python-amazon-mws#60 (python-amazon-mws#61)

* Fix issue#1

Always return an interable list.

Stolen from https://github.com/bloodywing Thanks!

* Fix issue python-amazon-mws#60

We must sort the params before encoding and concatenating or we will fail our calls.

This is a nice hybrid between the old version and a nicer more pythonic way of doing things with .join and not just appending to strings and then hacking the last ampersand off.

* Sorting of dict keys instead of the dict object

Essentially the same output, slightly more explicit for an easier time reading it later.

* Feeds example. (python-amazon-mws#64)

* Feeds example. Use of ".parsed" changed. (python-amazon-mws#66)

* Feeds example.

* Feeds example. Use of ".parsed" changed.

* Subscriptions api (python-amazon-mws#67)

* Fix issue#1

Always return an interable list.

Stolen from https://github.com/bloodywing Thanks!

* Fix issue python-amazon-mws#60

We must sort the params before encoding and concatenating or we will fail our calls.

This is a nice hybrid between the old version and a nicer more pythonic way of doing things with .join and not just appending to strings and then hacking the last ampersand off.

* Sorting of dict keys instead of the dict object

Essentially the same output, slightly more explicit for an easier time reading it later.

* Start working on the subscriptions API

* More updates to subscription to test.

* missed off Subscription

* remove subscription, example appears to not require this?

* subscription required for subscription calls, not on destination,

* flake8

make creation of call consistent accross this file.

* indentation error.

* Subscriptions (#9)

* Fix delete subscription

* Fix delete subscription

* Subscriptions (#10)

* Fix delete subscription

* Fix delete subscription

* _type -> notification_type

* small doc update

* Subscriptions (#11)

* Fix delete subscription

* Fix delete subscription

* _type -> notification_type

* small doc update

* change subscriptions attributes_list to be attributes (dictionary) then map the key and value into the correct style for enumeration

* Subscriptions (#12)

* Fix delete subscription

* Fix delete subscription

* _type -> notification_type

* small doc update

* change subscriptions attributes_list to be attributes (dictionary) then map the key and value into the correct style for enumeration

* flake8 after merge issues

* Subscriptions (#13)

* Fix delete subscription

* Fix delete subscription

* _type -> notification_type

* small doc update

* change subscriptions attributes_list to be attributes (dictionary) then map the key and value into the correct style for enumeration

* flake8 after merge issues

* missed off subscriptions in updated params

* flake8

* fix get_subscription

* move delivery_channel to the end of the params so it can be a default

* clean method (python-amazon-mws#65)

* clean input parameter

* Feeds example. Use of ".parsed" changed. (python-amazon-mws#66)

* Feeds example.

* Feeds example. Use of ".parsed" changed.

* see conversation pull request

* modified tests to fit new clean method

* revert start in subapi

* git ignore

* d

* r

* travis bugfix

* call clean method for params too

* reuse modifiers for request params

also it's helpful to understand how we modify params

* param test for wrong datatype exception

* clean all parameters at once

see idea from GriceTurrble in this pull request

* remove dt_iso_or_none

no need for this

* Feeds example. Use of ".parsed" changed. (python-amazon-mws#66)

* Feeds example.

* Feeds example. Use of ".parsed" changed.

* Revert "Feeds example. Use of ".parsed" changed. (python-amazon-mws#66)"

This reverts commit ba0f363.

* Revert "Feeds example. Use of ".parsed" changed. (python-amazon-mws#66)"

This reverts commit e87012b.

* Revert "Feeds example. Use of ".parsed" changed. (python-amazon-mws#66)"

This reverts commit 77d3ea7.

* Revert "Feeds example. (python-amazon-mws#64)"

This reverts commit 2a18583.

* Added support for zip files.

* ignore files

* Zip files downloaded to current directory.

* Added unzip() function in DataWrapper object.

* Minor updates, correcting my own mistakes from recent merge

* Remove "assert_no_token". Not used except in a single test.

* Fallback to _response_dict if _rootkey is not present in response dict (python-amazon-mws#72)

This is the case while fetching some of the reports. I particularly found this
in '_GET_XML_RETURNS_DATA_BY_RETURN_DATE_'. In this case the data is returned
but not in rootkey. This will at least let the user parse the data on there own

* Move flake8 checking after pytest calls

A current PR is using `enum`, which was added in Py3.4. That should have produced an error for a missing module in Py2.7 testing, but `flake8` loads `enum34` as a dependency into the environment first. This contaminates the test suite prior to running tests, hiding what should be an error.

* report enum and get_reportid (python-amazon-mws#74)

* report enum and get_reportid

* removed tuples since we do now handle the decoding better

* removed get_request id

and lets see if the test now fails

* Move flake8 checking after pytest calls

A current PR is using `enum`, which was added in Py3.4. That should have produced an error for a missing module in Py2.7 testing, but `flake8` loads `enum34` as a dependency into the environment first. This contaminates the test suite prior to running tests, hiding what should be an error.

* extra require python2.7 enum34

* Streamline package requirements for enum34

* Bugfix, my mistake. Import setuptools needed

* ... and sys

* Push dev version num

We've gone several versions up, technically, without changing the version num to match. May as well start somewhere.

* Dev version num push (match setup)

* Call to requests.request needs explicit timeout (python-amazon-mws#87)

* Call to requests.request needs explicit timeout

Call to requests.request doesn't explicitly mention timeout, without which could lead to zombie processes as default timeout is infinity (None).

* Add marketplace ID enums #19 (python-amazon-mws#84)

* enum marketplaces

* typos

* removed domain parameter, pls use region now, see MARKETPLACES

* very basic tests

* python-amazon-mws#91 add BR and AU and sort alphabetical

* single quotes

* better name for variable

* idiomatic names, thanks to jameshiew

* Changed excludeme default to be xsd1.1 compatible (python-amazon-mws#97)

Occasionally, the MWS API for Products will throw an error, citing a
non-xsd1.1 boolean as an example. Making the default value for the
keyword argument excludeme into "false" fixes this.

* Revert "Merge branch 'develop' into develop"

This reverts commit 1a15914, reversing
changes made to a7886c7.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0