B
    ?F[                 @   s  d dl Zd dlZd dlZd dlZd dlmZ d dlmZ d dl	Z
d dlZ
d dlmZ d dlmZmZmZmZ dgZdddd	d
dddddddddZdd ZdZi Zdd Zdd Zdd Zd/ddZd d! Zd"d# Zd$d% Zd&d' Zd(d) Z d*d+ Z!d,d- Z"G d.d deZ#dS )0    N)AWSQueryConnection)BotoServerError)
XmlHandler)filtermapsixencodebytesMWSConnection)z
2009-01-01Merchant/)z
2013-09-01SellerIdz/Orders/2013-09-01)z
2011-10-01r   z/Products/2011-10-01)z
2011-07-01r   z/Sellers/2011-07-01)z
2010-10-01r   z&/FulfillmentInboundShipment/2010-10-01)z
2010-10-01r   z'/FulfillmentOutboundShipment/2010-10-01)z
2010-10-01r   z /FulfillmentInventory/2010-10-01)z
2013-04-01r   z/Recommendations/2013-04-01)z
2014-03-01r   z/CustomerInformation/2014-03-01)z
2014-03-01r   z/CartInformation/2014-03-01)z
2013-07-01r   z/Subscriptions/2013-07-01)z
2013-01-01r   z/OffAmazonPayments/2013-01-01)FeedsReportsOrdersProductsSellersInboundOutbound	InventoryRecommendationsCustomerInfoCartInfoSubscriptionsOffAmazonPaymentsc             C   s   t t|   S )N)r   hashlibZmd5digeststrip)c r   2lib/python3.7/site-packages/boto/mws/connection.py<lambda>9   s    r    )actionresponsesectionquotarestoreversionc             C   s,   x t D ]}t||t| |d  qW | |_|S )N)decorated_attrssetattrgetattr__wrapped__)functoattrr   r   r   add_attrs_from?   s    
r.   c                 s    fdd}|S )Nc                s0    fdd}d  jd|_t |dS )Nc                s   xzdd  D D ]h\}}||kr|d | |r2dp4d }x4t t|| D ] }|| | ||t|d  < qJW || qW | f||S )Nc             S   s   g | ]}| d qS ).)split).0fr   r   r   
<listcomp>K   s    zHstructured_lists.<locals>.decorator.<locals>.wrapper.<locals>.<listcomp>r/       )rangelenstrpop)selfargskwkeyZaccZnewkeyi)fieldsr+   r   r   wrapperJ   s     z4structured_lists.<locals>.decorator.<locals>.wrapperz{0}
Lists: {1}z, )r,   )format__doc__joinr.   )r+   r@   )r?   )r+   r   	decoratorH   s    z#structured_lists.<locals>.decoratorr   )r?   rD   r   )r?   r   structured_listsF   s    rE   c                s    fdd}|S )Nc                s*    fdd}d  j|_t |dS )Nc                 sd   t  fdddfD r0dj}t|  d<  dt d d d< |  S )Nc                s   g | ]}| kqS r   r   )r1   r2   )r<   r   r   r3   ]   s    zAhttp_body.<locals>.decorator.<locals>.wrapper.<locals>.<listcomp>Zcontent_typezB{0} requires {1} and content_type arguments for building HTTP bodybody)zContent-TypezContent-MD5headers)anyrA   r!   KeyErrorr9   content_md5)r;   r<   message)fieldr+   )r<   r   r@   \   s    
z-http_body.<locals>.decorator.<locals>.wrapperz{0}
Required HTTP Body: {1})r,   )rA   rB   r.   )r+   r@   )rL   )r+   r   rD   Z   s    zhttp_body.<locals>.decoratorr   )rL   rD   r   )rL   r   	http_bodyX   s    rM   Fc             C   s   t | tjjjr$t| j|||d nt | tjrhx| D ],}|	drFq6t| | ||d | |d q6W nt | t
jr~| ||< ntt | tjrxft| D ]4\}}|rdpdt|d  }t|||| |d qW n$t | trt|  ||< n| ||< d S )N)members_r/   z.member.r5   )
isinstancebotomwsr"   ZResponseElementdestructure_object__dict__collectionsMapping
startswithr   Zstring_typesIterable	enumerater8   boollower)valueZintoprefixrN   nameindexelementsuffixr   r   r   rS   m   s$    



rS   c                 s    fdd}|S )Nc                s2    fdd}d  jd|_t |dS )Nc                 sH    dd}x0t fddD ]}t | ||d q W |  S )NrN   Fc                s   |  kS )Nr   )r>   )r<   r   r   r       s    zHstructured_objects.<locals>.decorator.<locals>.wrapper.<locals>.<lambda>)rN   )getr   rS   r9   )r;   r<   rN   rL   )r?   r+   kwargs)r<   r   r@      s    z6structured_objects.<locals>.decorator.<locals>.wrapperzJ{0}
Element|Iter|Map: {1}
(ResponseElement or anything iterable/dict-like)z, )r,   )rA   rB   rC   r.   )r+   r@   )r?   rc   )r+   r   rD      s    z%structured_objects.<locals>.decoratorr   )r?   rc   rD   r   )r?   rc   r   structured_objects   s    rd   c                 s    fdd}|S )Nc                s>    fdd}d dd D }d j||_t |dS )Nc                 sV    fdd}dt tt|krLddd D }dj|}t||  S )Nc                s   t  fdd| D S )Nc             3   s   | ]}| kV  qd S )Nr   )r1   r=   )r<   r   r   	<genexpr>   s    zRrequires.<locals>.decorator.<locals>.requires.<locals>.<lambda>.<locals>.<genexpr>)all)group)r<   r   r   r       s    z?requires.<locals>.decorator.<locals>.requires.<locals>.<lambda>r5   z OR c             S   s   g | ]}d  |qS )+)rC   )r1   gr   r   r   r3      s    zArequires.<locals>.decorator.<locals>.requires.<locals>.<listcomp>z{0} requires {1} argument(s))r7   listr   rC   rA   r!   rI   )r;   r<   hasgrouprK   )r+   groups)r<   r   requires   s    
z-requires.<locals>.decorator.<locals>.requiresz OR c             S   s   g | ]}d  |qS )rh   )rC   )r1   ri   r   r   r   r3      s    z/requires.<locals>.decorator.<locals>.<listcomp>z{0}
Required: {1})r,   )rC   rA   rB   r.   )r+   rm   rK   )rl   )r+   r   rD      s
    zrequires.<locals>.decoratorr   )rl   rD   r   )rl   r   rm      s    rm   c                 s    fdd}|S )Nc                s>    fdd}d dd D }d j||_t |dS )Nc                 sV    fdd}t tt|dkrLddd D }dj|}t||  S )Nc                s   t  fdd| D S )Nc             3   s   | ]}| kV  qd S )Nr   )r1   r=   )r<   r   r   re      s    zRexclusive.<locals>.decorator.<locals>.wrapper.<locals>.<lambda>.<locals>.<genexpr>)rf   )rg   )r<   r   r   r       s    z?exclusive.<locals>.decorator.<locals>.wrapper.<locals>.<lambda>)r   r5   z OR c             S   s   g | ]}d  |qS )rh   )rC   )r1   ri   r   r   r   r3      s    zAexclusive.<locals>.decorator.<locals>.wrapper.<locals>.<listcomp>z{0} requires either {1})r7   rj   r   rC   rA   r!   rI   )r;   r<   rk   rK   )r+   rl   )r<   r   r@      s    
z-exclusive.<locals>.decorator.<locals>.wrapperz OR c             S   s   g | ]}d  |qS )rh   )rC   )r1   ri   r   r   r   r3      s    z0exclusive.<locals>.decorator.<locals>.<listcomp>z{0}
Either: {1})r,   )rC   rA   rB   r.   )r+   r@   rK   )rl   )r+   r   rD      s
    zexclusive.<locals>.decoratorr   )rl   rD   r   )rl   r   	exclusive   s    rn   c                s    fdd}|S )Nc                sB    fdd}d dd D }d j||_t |dS )Nc                 s`   fdd krVt  fddD sVddd D }dj|}t|| S )	Nc                s   t  fdd| D S )Nc             3   s   | ]}| kV  qd S )Nr   )r1   r=   )r<   r   r   re      s    zRdependent.<locals>.decorator.<locals>.wrapper.<locals>.<lambda>.<locals>.<genexpr>)rf   )rg   )r<   r   r   r       s    z?dependent.<locals>.decorator.<locals>.wrapper.<locals>.<lambda>c             3   s   | ]} |V  qd S )Nr   )r1   ri   )rk   r   r   re      s    z@dependent.<locals>.decorator.<locals>.wrapper.<locals>.<genexpr>z OR c             S   s   g | ]}d  |qS )rh   )rC   )r1   ri   r   r   r   r3      s    zAdependent.<locals>.decorator.<locals>.wrapper.<locals>.<listcomp>z{0} argument {1} requires {2})rH   rC   rA   r!   rI   )r;   r<   rK   )rL   r+   rl   )rk   r<   r   r@      s    z-dependent.<locals>.decorator.<locals>.wrapperz OR c             S   s   g | ]}d  |qS )rh   )rC   )r1   ri   r   r   r   r3      s    z0dependent.<locals>.decorator.<locals>.<listcomp>z{0}
{1} requires: {2})r,   )rC   rA   rB   r.   )r+   r@   rK   )rL   rl   )r+   r   rD      s    zdependent.<locals>.decoratorr   )rL   rl   rD   r   )rL   rl   r   	dependent   s    ro   c                 s    fdd}|S )Nc                s0    fdd}d  jd|_t |dS )Nc                 s<   t  fddD s2djd}t||  S )Nc             3   s   | ]}| kV  qd S )Nr   )r1   r>   )r<   r   r   re      s    zHrequires_some_of.<locals>.decorator.<locals>.requires.<locals>.<genexpr>z,{0} requires at least one of {1} argument(s)z, )rH   rA   r!   rC   rI   )r;   r<   rK   )r?   r+   )r<   r   rm      s
    z5requires_some_of.<locals>.decorator.<locals>.requiresz{0}
Some Required: {1}z, )r,   )rA   rB   rC   r.   )r+   rm   )r?   )r+   r   rD      s    z#requires_some_of.<locals>.decoratorr   )r?   rD   r   )r?   r   requires_some_of   s    rp   c                 s    fdd}|S )Nc                s0    fdd}d  jd|_t |dS )Nc                 s:   x. fddD D ]}t  |   |< qW |  S )Nc                s    g | ]}t  |tr|qS r   )rP   rb   rZ   )r1   r2   )r<   r   r   r3      s    zIboolean_arguments.<locals>.decorator.<locals>.wrapper.<locals>.<listcomp>)r8   r[   )r;   r<   rL   )r?   r+   )r<   r   r@      s    z5boolean_arguments.<locals>.decorator.<locals>.wrapperz{0}
Booleans: {1}z, )r,   )rA   rB   rC   r.   )r+   r@   )r?   )r+   r   rD      s    z$boolean_arguments.<locals>.decoratorr   )r?   rD   r   )r?   r   boolean_arguments   s    	rq   c                s    t |t|f fdd	}|S )Nc                s   t  \ dp(ttjjd fdd}x tD ]}t||t	 
| qJW dj|_jt< |S )Nr4   rO   c                sv   |  t|  d  |  d kr6d  }t||d< |d< | j| d}td}| ||f||S )Nz?{0} requires {1} argument. Set the MWSConnection.{2} attribute?ZActionZVersion)Z
connection)pathr$   r%   )
setdefaultr)   rA   rI   Z_response_factorydict)r:   r;   r<   rK   r"   request)	accesskeyr!   r+   rr   r$   r%   r&   r   r   r@      s    
z.api_action.<locals>.decorator.<locals>.wrapperz3MWS {0}/{1} API call; quota={2} restore={3:.2f}
{4})api_version_pathrC   r   r8   
capitalize__name__r0   r'   r(   localsrb   rA   rB   api_call_map)r+   r$   r%   r@   r-   )apir#   )rv   r!   r+   rr   r$   r%   r&   r   rD      s    


zapi_action.<locals>.decorator)intfloat)r#   r$   r%   r|   rD   r   )r|   r#   r   
api_action   s    r   c                   s~  e Zd ZejjjZejjjZ fddZ	dd Z
dd Zdd ZdSddZdd Zdd Zdd Zdd ZedgededededdddTddZeddd edd!d"d#d$ Zed%gedd&d&d'd( Zedd edd!d"d)d* Zeddedd!d"d+d, Zed-geddd.d/d0 Zd1d2 Zed3geded4ed5dd.d6d7 Zed8d9d:ed5d!d"d;d< Zed%ged5d&d&d=d> Z ed9d:ed5d!d"d?d@ Z!ed5d!d"dAdB Z"edCed8d9ed5d!d.dDdE Z#ed%ged5d&d&dFdG Z$edCed9ed5d!d"dHdI Z%edJged5dd.dKdL Z&ed3dMged5d!d"dNdO Z'ed9ed5d!d"dPdQ Z(ed%ged5d&d&dRdS Z)ed9ed5d!d"dTdU Z*edVgedCedWed5d!d"dXdY Z+edZd[ge,dZd[ed\d]d^d_d` Z-edadbdcge,dbdced\d]d^ddde Z.edage,dbdced\d]d^dfdg Z/e0dhdiedjdked\d]d^dldm Z1ed%ged\d]d^dndo Z2edagdpdqged\d]d^drds Z3ed%ged\d]d^dtdu Z4ed\dvdwdxdydz Z5ed{gd|ged}ed~d]d^dd Z6ed%ged~d]d^dd Z7ed~dvdwdxdd Z8edgedd]d^dd Z9eddge,ddedd]d^dd Z:edddddddge,ddedd]d^dd Z;edgedd]d^dd Z<edd]d^dd Z=ed%gedd]d^dd Z>edgedd]d^dd Z?eddvdwdxdd Z@edgdpgedgeAdgdpgeBddgeAdpgdgdgeBdqdpgeAdgdqge,dddeddddeddd.dd ZCed%geddd.dd ZDedgededdd.dd ZEedgedd]dvdd ZFed%gedd]dvdd ZGeddvdwdxdd ZHeddgeddddd ZIeddgededddddÄ ZJedddgedƃedddddȄ ZKeddgedʃeddd!d˃dd̈́ ZLeddgededdd!d΃ddЄ ZMeddgedʃedddd҃ddԄ ZNeddgededdddՃddׄ ZOeddgeddddكddۄ ZPeddgedddd݃dd߄ ZQeddvdwdxdd ZReddgedʃeddd!ddd ZSeddgededdd!ddd ZTeddd.dd ZUed%geddd.dd ZVedgedddvdd ZWedgededddvdd ZXed%gedddvdd ZYeddvdwdxdd ZZeddddd Z[ed%geddddd Z\edged eddddd Z]eddvdwdxdd Z^edgeddddd Z_ed%gedddd	d
 Z`edgededdddd Zaeddvdwdxdd Zbeddge,dddeddd^dd Zceddge,dddeddd^dd Zdedgeddd^dd Zeeddge,dddeddd^dd Zfeddge,dddeddd^dd  Zgedd!dge,dddeddd^d"d# Zhedd!dge,dddeddd^d$d% Ziedgeddd^d&d' Zjeddge,dddeddd^d(d) Zkeddvdwdxd*d+ Zled,d-ge,d-ed.d!d/d0d1 Zmed,ged.ddvd2d3 Zned,ged.d!d/d4d5 Zoed,ged.d!d/d6d7 Zped,ged.d!d/d8d9 Zqed,d:d;ge,d;ed.d!d/d<d= Zred>ged.ddvd?d@ Zsed>dAdBge,dBed.d!d/dCdD ZtedEged.ddvdFdG Zued>ged.d!d/dHdI ZvedEdJdKge,dKed.d!d/dLdM ZwedNged.ddvdOdP Zxed.dvdwdxdQdR Zy  ZzS (U  r	   c                sr   | dd |dd| _|dd p.|d| _|dd pB| j| _| j|dg f|}tt| j	|| d S )Nhostzmws.amazonservices.comZsandboxFr
   r   Zfactory_scopes)
rs   r9   
_sandboxedrb   r
   r   _setup_factoriessuperr	   __init__)r:   r;   r<   )	__class__r   r   r     s    zMWSConnection.__init__c             K   sx   xrt jj| jft jj| jfd D ]L\}\}}||krPt| d| || q$||g }t| d| ||d q$W |S )N)Zresponse_factoryZresponse_error_factoryrO   )scopes)	rQ   rR   r"   ResponseFactory	exceptionResponseErrorFactoryitemsr(   r9   )r:   Zextrascopesr<   factoryZscopeZDefaultr   r   r   r   r     s    "
zMWSConnection._setup_factoriesc             C   s.   | j s
|S |d}|d  d7  < d|S )Nr   Z_Sandbox)r   r0   rC   )r:   rr   Zsplatr   r   r   _sandboxify"  s
    
zMWSConnection._sandboxifyc             C   s   dgS )NrR   r   )r:   r   r   r   _required_auth_capability)  s    z'MWSConnection._required_auth_capabilityr4   Nc          
   C   s6  |pi }|  |d }| jd|d|||| jd}y| j|dd}W n6 tk
rx } z| |j|j|jW dd}~X Y nX |	 }t
j| |st
jd|  | |j|j||jdkrt
jd|j|jf  t
jd	|  | |j|j||d
}	|	dk	rt||	kst|d}
| ||
|S )zyMake a POST request, optionally with a content body,
           and return the response, optionally as raw text.
        rr   ZPOSTN)dataparamsrG   r   )Zoverride_num_retrieszNull body %s   z%s %sz%szContent-MD5zContent-Type)r   Zbuild_base_http_requestr   Z_mexer   Z_response_error_factoryZstatusreasonrF   readrQ   logdebugerrorZ	getheaderrJ   AssertionError_parse_response)r:   ru   r   parserrF   rG   rr   r"   Zbsr   contenttyper   r   r   _post_request,  s2    
&





zMWSConnection._post_requestc             C   s*   | ds|S t|| }tj|| |S )Nztext/xml)rW   r   xmlZsaxZparseString)r:   r   r   rF   Zhandlerr   r   r   r   J  s
    

zMWSConnection._parse_responsec             C   s2   d|krt |dp|}|tkr.t| t| S dS )zReturn the MWS API method referred to in the argument.
           The named method can be in CamelCase or underlined_lower_case.
           This is the complement to MWSConnection.any_call.action
        rO   N)stringZcapwordsr{   r)   )r:   r^   r!   r   r   r   
method_forQ  s    zMWSConnection.method_forc             O   s,   |  |}|std|| |||S )zPass a call name as the first argument and a generator
           is returned for the initial response and any continuation
           call responses made using the NextToken.
        zNo call named "{0}")r   r   rA   iter_response)r:   Zcallr;   r<   methodr   r   r   	iter_call[  s    
zMWSConnection.iter_callc             c   sD   |V  |  |jd }x(|r>|jjdkr>||jjd}|V  qW dS )zPass a call's response as the initial argument and a
           generator is returned for the initial response and any
           continuation call responses made using the NextToken.
        ZByNextTokentrue)	NextTokenN)r   Z_actionZ_resultZHasNextr   )r:   r"   Zmorer   r   r   r   d  s
    zMWSConnection.iter_responseZFeedTypeZPurgeAndReplaceZFeedContentzMarketplaceIdList.Idr      x   c             K   s   |pi }| j |||||dS )z5Uploads a feed for processing by Amazon MWS.
        )rF   rG   )r   )r:   ru   r"   rG   rF   r<   r   r   r   submit_feedo  s    zMWSConnection.submit_feedzFeedSubmissionIdList.IdzFeedTypeList.TypezFeedProcessingStatusList.Status
   -   c             K   s   |  |||S )z]Returns a list of all feed submissions submitted in the
           previous 90 days.
        )r   )r:   ru   r"   r<   r   r   r   get_feed_submission_list{  s    z&MWSConnection.get_feed_submission_listr   r   c             K   s   |  |||S )zJReturns a list of feed submissions using the NextToken parameter.
        )r   )r:   ru   r"   r<   r   r   r   &get_feed_submission_list_by_next_token  s    z4MWSConnection.get_feed_submission_list_by_next_tokenc             K   s   |  |||S )zHReturns a count of the feeds submitted in the previous 90 days.
        )r   )r:   ru   r"   r<   r   r   r   get_feed_submission_count  s    z'MWSConnection.get_feed_submission_countc             K   s   |  |||S )zxCancels one or more feed submissions and returns a
           count of the feed submissions that were canceled.
        )r   )r:   ru   r"   r<   r   r   r   cancel_feed_submissions  s    z%MWSConnection.cancel_feed_submissionsZFeedSubmissionId<   c             K   s   |  |||S )z,Returns the feed processing report.
        )r   )r:   ru   r"   r<   r   r   r   get_feed_submission_result  s    z(MWSConnection.get_feed_submission_resultc             K   s2   d ttjt }d| jj|}t	|dS )z8Instruct the user on how to get service status.
        z, zTUse {0}.get_(section)_service_status(), where (section) is one of the following: {1}N)
rC   r   r8   r[   rw   keysrA   r   ry   AttributeError)r:   r<   ZsectionsrK   r   r   r   get_service_status  s    z MWSConnection.get_service_statusZ
ReportTypezReportOptions=ShowSalesChannelr   c             K   s   |  |||S )zHCreates a report request and submits the request to Amazon MWS.
        )r   )r:   ru   r"   r<   r   r   r   request_report  s    zMWSConnection.request_reportzReportRequestIdList.IdzReportTypeList.Typez!ReportProcessingStatusList.Statusc             K   s   |  |||S )zoReturns a list of report requests that you can use to get the
           ReportRequestId for a report.
        )r   )r:   ru   r"   r<   r   r   r   get_report_request_list  s    z%MWSConnection.get_report_request_listc             K   s   |  |||S )a
  Returns a list of report requests using the NextToken,
           which was supplied by a previous request to either
           GetReportRequestListByNextToken or GetReportRequestList, where
           the value of HasNext was true in that previous request.
        )r   )r:   ru   r"   r<   r   r   r   %get_report_request_list_by_next_token  s    z3MWSConnection.get_report_request_list_by_next_tokenc             K   s   |  |||S )zmReturns a count of report requests that have been submitted
           to Amazon MWS for processing.
        )r   )r:   ru   r"   r<   r   r   r   get_report_request_count  s    z&MWSConnection.get_report_request_countc             K   s   |  |||S )zCancel one or more report requests, returning the count of the
           canceled report requests and the report request information.
        )r   )r:   ru   r"   r<   r   r   r   cancel_report_requests  s    z$MWSConnection.cancel_report_requestsZAcknowledgedc             K   s   |  |||S )zxReturns a list of reports that were created in the previous
           90 days that match the query parameters.
        )r   )r:   ru   r"   r<   r   r   r   get_report_list  s    zMWSConnection.get_report_listc             K   s   |  |||S )zReturns a list of reports using the NextToken, which
           was supplied by a previous request to either
           GetReportListByNextToken or GetReportList, where the
           value of HasNext was true in the previous call.
        )r   )r:   ru   r"   r<   r   r   r   get_report_list_by_next_token  s    z+MWSConnection.get_report_list_by_next_tokenc             K   s   |  |||S )zReturns a count of the reports, created in the previous 90 days,
           with a status of _DONE_ and that are available for download.
        )r   )r:   ru   r"   r<   r   r   r   get_report_count  s    zMWSConnection.get_report_countZReportIdc             K   s   |  |||S )z*Returns the contents of a report.
        )r   )r:   ru   r"   r<   r   r   r   
get_report  s    zMWSConnection.get_reportZSchedulec             K   s   |  |||S )zgCreates, updates, or deletes a report request schedule for
           a specified report type.
        )r   )r:   ru   r"   r<   r   r   r   manage_report_schedule  s    z$MWSConnection.manage_report_schedulec             K   s   |  |||S )z|Returns a list of order report requests that are scheduled
           to be submitted to Amazon MWS for processing.
        )r   )r:   ru   r"   r<   r   r   r   get_report_schedule_list  s    z&MWSConnection.get_report_schedule_listc             K   s   |  |||S )a  Returns a list of report requests using the NextToken,
           which was supplied by a previous request to either
           GetReportScheduleListByNextToken or GetReportScheduleList,
           where the value of HasNext was true in that previous request.
        )r   )r:   ru   r"   r<   r   r   r   &get_report_schedule_list_by_next_token	  s    z4MWSConnection.get_report_schedule_list_by_next_tokenc             K   s   |  |||S )znReturns a count of order report requests that are scheduled
           to be submitted to Amazon MWS.
        )r   )r:   ru   r"   r<   r   r   r   get_report_schedule_count  s    z'MWSConnection.get_report_schedule_countZReportIdListzReportIdList.Idc             K   s   |  |||S )z@Updates the acknowledged status of one or more reports.
        )r   )r:   ru   r"   r<   r   r   r   update_report_acknowledgements  s    z,MWSConnection.update_report_acknowledgementsZShipFromAddressZInboundShipmentPlanRequestItemsr      g      ?c             K   s   |  |||S )zHReturns the information required to create an inbound shipment.
        )r   )r:   ru   r"   r<   r   r   r   create_inbound_shipment_plan$  s    z*MWSConnection.create_inbound_shipment_planZ
ShipmentIdZInboundShipmentHeaderZInboundShipmentItemsc             K   s   |  |||S )z%Creates an inbound shipment.
        )r   )r:   ru   r"   r<   r   r   r   create_inbound_shipment,  s    z%MWSConnection.create_inbound_shipmentc             K   s   |  |||S )zUpdates an existing inbound shipment.  Amazon documentation
           is ambiguous as to whether the InboundShipmentHeader and
           InboundShipmentItems arguments are required.
        )r   )r:   ru   r"   r<   r   r   r   update_inbound_shipment4  s    z%MWSConnection.update_inbound_shipmentZShipmentIdListZShipmentStatusListzShipmentIdList.IdzShipmentStatusList.Statusc             K   s   |  |||S )z[Returns a list of inbound shipments based on criteria that
           you specify.
        )r   )r:   ru   r"   r<   r   r   r   list_inbound_shipments>  s    z$MWSConnection.list_inbound_shipmentsc             K   s   |  |||S )z]Returns the next page of inbound shipments using the NextToken
           parameter.
        )r   )r:   ru   r"   r<   r   r   r   $list_inbound_shipments_by_next_tokenG  s    z2MWSConnection.list_inbound_shipments_by_next_tokenLastUpdatedAfterLastUpdatedBeforec             K   s   |  |||S )zReturns a list of items in a specified inbound shipment, or a
           list of items that were updated within a specified time frame.
        )r   )r:   ru   r"   r<   r   r   r   list_inbound_shipment_itemsO  s    z)MWSConnection.list_inbound_shipment_itemsc             K   s   |  |||S )zbReturns the next page of inbound shipment items using the
           NextToken parameter.
        )r   )r:   ru   r"   r<   r   r   r   )list_inbound_shipment_items_by_next_tokenW  s    z7MWSConnection.list_inbound_shipment_items_by_next_token   i,  ZGetServiceStatusc             K   s   |  |||S )zcReturns the operational status of the Fulfillment Inbound
           Shipment API section.
        )r   )r:   ru   r"   r<   r   r   r   get_inbound_service_status_  s    z(MWSConnection.get_inbound_service_statusZ
SellerSkusZQueryStartDateTimezSellerSkus.memberr   c             K   s   |  |||S )zWReturns information about the availability of a seller's
           inventory.
        )r   )r:   ru   r"   r<   r   r   r   list_inventory_supplyf  s    z#MWSConnection.list_inventory_supplyc             K   s   |  |||S )zReturns the next page of information about the availability
           of a seller's inventory using the NextToken parameter.
        )r   )r:   ru   r"   r<   r   r   r   #list_inventory_supply_by_next_tokeno  s    z1MWSConnection.list_inventory_supply_by_next_tokenc             K   s   |  |||S )z\Returns the operational status of the Fulfillment Inventory
           API section.
        )r   )r:   ru   r"   r<   r   r   r   get_inventory_service_statusw  s    z*MWSConnection.get_inventory_service_statusZPackageNumberr   c             K   s   |  |||S )zReturns delivery tracking information for a package in
           an outbound shipment for a Multi-Channel Fulfillment order.
        )r   )r:   ru   r"   r<   r   r   r   get_package_tracking_details~  s    z*MWSConnection.get_package_tracking_detailsZAddressZItemsc             K   s   |  |||S )zReturns a list of fulfillment order previews based on items
           and shipping speed categories that you specify.
        )r   )r:   ru   r"   r<   r   r   r   get_fulfillment_preview  s    z%MWSConnection.get_fulfillment_previewZSellerFulfillmentOrderIdZDisplayableOrderIdZShippingSpeedCategoryZDisplayableOrderDateTimeZDestinationAddressZDisplayableOrderCommentc             K   s   |  |||S )ziRequests that Amazon ship items from the seller's inventory
           to a destination address.
        )r   )r:   ru   r"   r<   r   r   r   create_fulfillment_order  s    
z&MWSConnection.create_fulfillment_orderc             K   s   |  |||S )z^Returns a fulfillment order based on a specified
           SellerFulfillmentOrderId.
        )r   )r:   ru   r"   r<   r   r   r   get_fulfillment_order  s    z#MWSConnection.get_fulfillment_orderc             K   s   |  |||S )z{Returns a list of fulfillment orders fulfilled after (or
           at) a specified date or by fulfillment method.
        )r   )r:   ru   r"   r<   r   r   r   list_all_fulfillment_orders  s    z)MWSConnection.list_all_fulfillment_ordersc             K   s   |  |||S )zbReturns the next page of inbound shipment items using the
           NextToken parameter.
        )r   )r:   ru   r"   r<   r   r   r   )list_all_fulfillment_orders_by_next_token  s    z7MWSConnection.list_all_fulfillment_orders_by_next_tokenc             K   s   |  |||S )zbRequests that Amazon stop attempting to fulfill an existing
           fulfillment order.
        )r   )r:   ru   r"   r<   r   r   r   cancel_fulfillment_order  s    z&MWSConnection.cancel_fulfillment_orderc             K   s   |  |||S )z[Returns the operational status of the Fulfillment Outbound
           API section.
        )r   )r:   ru   r"   r<   r   r   r   get_outbound_service_status  s    z)MWSConnection.get_outbound_service_statusZCreatedAfterZMarketplaceIdZCreatedBefore
BuyerEmailSellerOrderIdZ
OrderTotalZShippingAddressZPaymentExecutionDetailzMarketplaceId.IdzOrderStatus.StatuszFulfillmentChannel.ChannelzPaymentMethod.r      c                sz   t d}xb|dg|dgd D ]@\} ||kr(t fdd|D r(dd |}t|q(W | |||S )	zeReturns a list of orders created or updated during a time
           frame that you specify.
        )zFulfillmentChannel.Channel.1zOrderStatus.Status.1zPaymentMethod.1r   r   r   r   )r   r   c             3   s   | ]}| kV  qd S )Nr   )r1   r>   )dontr   r   re     s    z,MWSConnection.list_orders.<locals>.<genexpr>z%Don't include {0} when specifying {1}z or )setunionr   rH   rA   rC   r   r   )r:   ru   r"   r<   ZtoggleZdorK   r   )r   r   list_orders  s    
zMWSConnection.list_ordersc             K   s   |  |||S )zReturns the next page of orders using the NextToken value
           that was returned by your previous request to either
           ListOrders or ListOrdersByNextToken.
        )r   )r:   ru   r"   r<   r   r   r   list_orders_by_next_token  s    z'MWSConnection.list_orders_by_next_tokenZAmazonOrderIdzAmazonOrderId.Idc             K   s   |  |||S )zBReturns an order for each AmazonOrderId that you specify.
        )r   )r:   ru   r"   r<   r   r   r   	get_order  s    zMWSConnection.get_orderc             K   s   |  |||S )zYReturns order item information for an AmazonOrderId that
           you specify.
        )r   )r:   ru   r"   r<   r   r   r   list_order_items  s    zMWSConnection.list_order_itemsc             K   s   |  |||S )zReturns the next page of order items using the NextToken
           value that was returned by your previous request to either
           ListOrderItems or ListOrderItemsByNextToken.
        )r   )r:   ru   r"   r<   r   r   r   list_order_items_by_next_token  s    z,MWSConnection.list_order_items_by_next_tokenc             K   s   |  |||S )zBReturns the operational status of the Orders API section.
        )r   )r:   ru   r"   r<   r   r   r   get_orders_service_status   s    z'MWSConnection.get_orders_service_statusZQueryr      c             K   s   |  |||S )zReturns a list of products and their attributes, ordered
           by relevancy, based on a search query that you specify.
        )r   )r:   ru   r"   r<   r   r   r   list_matching_products  s    z$MWSConnection.list_matching_productsZASINListzASINList.ASINc             K   s   |  |||S )zuReturns a list of products and their attributes, based on
           a list of ASIN values that you specify.
        )r   )r:   ru   r"   r<   r   r   r   get_matching_product  s    z"MWSConnection.get_matching_productZIdTypeZIdListz	IdList.Idc             K   s   |  |||S )zuReturns a list of products and their attributes, based on
           a list of Product IDs that you specify.
        )r   )r:   ru   r"   r<   r   r   r   get_matching_product_for_id  s    z)MWSConnection.get_matching_product_for_idZSellerSKUListzSellerSKUList.SellerSKUZGetCompetitivePricingForSKUc             K   s   |  |||S )zReturns the current competitive pricing of a product,
           based on the SellerSKUs and MarketplaceId that you specify.
        )r   )r:   ru   r"   r<   r   r   r   get_competitive_pricing_for_sku   s    z-MWSConnection.get_competitive_pricing_for_skuZGetCompetitivePricingForASINc             K   s   |  |||S )zReturns the current competitive pricing of a product,
           based on the ASINs and MarketplaceId that you specify.
        )r   )r:   ru   r"   r<   r   r   r    get_competitive_pricing_for_asin)  s    z.MWSConnection.get_competitive_pricing_for_asin   ZGetLowestOfferListingsForSKUc             K   s   |  |||S )ztReturns the lowest price offer listings for a specific
           product by item condition and SellerSKUs.
        )r   )r:   ru   r"   r<   r   r   r   !get_lowest_offer_listings_for_sku2  s    z/MWSConnection.get_lowest_offer_listings_for_skuZGetLowestOfferListingsForASINc             K   s   |  |||S )zoReturns the lowest price offer listings for a specific
           product by item condition and ASINs.
        )r   )r:   ru   r"   r<   r   r   r   "get_lowest_offer_listings_for_asin;  s    z0MWSConnection.get_lowest_offer_listings_for_asinZ	SellerSKUZGetProductCategoriesForSKUc             K   s   |  |||S )zDReturns the product categories that a SellerSKU belongs to.
        )r   )r:   ru   r"   r<   r   r   r   get_product_categories_for_skuD  s    z,MWSConnection.get_product_categories_for_skuZASINZGetProductCategoriesForASINc             K   s   |  |||S )z@Returns the product categories that an ASIN belongs to.
        )r   )r:   ru   r"   r<   r   r   r   get_product_categories_for_asinK  s    z-MWSConnection.get_product_categories_for_asinc             K   s   |  |||S )zDReturns the operational status of the Products API section.
        )r   )r:   ru   r"   r<   r   r   r   get_products_service_statusR  s    z)MWSConnection.get_products_service_statusZGetMyPriceForSKUc             K   s   |  |||S )zUReturns pricing information for your own offer listings, based on SellerSKU.
        )r   )r:   ru   r"   r<   r   r   r   get_my_price_for_skuX  s    z"MWSConnection.get_my_price_for_skuZGetMyPriceForASINc             K   s   |  |||S )zPReturns pricing information for your own offer listings, based on ASIN.
        )r   )r:   ru   r"   r<   r   r   r   get_my_price_for_asin`  s    z#MWSConnection.get_my_price_for_asinr   c             K   s   |  |||S )zReturns a list of marketplaces that the seller submitting
           the request can sell in, and a list of participations that
           include seller-specific information in that marketplace.
        )r   )r:   ru   r"   r<   r   r   r   list_marketplace_participationsh  s    z-MWSConnection.list_marketplace_participationsc             K   s   |  |||S )zReturns the next page of marketplaces and participations
           using the NextToken value that was returned by your
           previous request to either ListMarketplaceParticipations
           or ListMarketplaceParticipationsByNextToken.
        )r   )r:   ru   r"   r<   r   r   r   -list_marketplace_participations_by_next_tokenp  s    	z;MWSConnection.list_marketplace_participations_by_next_tokenr   c             K   s   |  |||S )zChecks whether there are active recommendations for each category
           for the given marketplace, and if there are, returns the time when
           recommendations were last updated for each category.
        )r   )r:   ru   r"   r<   r   r   r   )get_last_updated_time_for_recommendations{  s    z7MWSConnection.get_last_updated_time_for_recommendationszCategoryQueryList.CategoryQueryc             K   s   |  |||S )zReturns your active recommendations for a specific category or for
           all categories for a specific marketplace.
        )r   )r:   ru   r"   r<   r   r   r   list_recommendations  s    z"MWSConnection.list_recommendationsc             K   s   |  |||S )z[Returns the next page of recommendations using the NextToken
           parameter.
        )r   )r:   ru   r"   r<   r   r   r   "list_recommendations_by_next_token  s    z0MWSConnection.list_recommendations_by_next_tokenc             K   s   |  |||S )zKReturns the operational status of the Recommendations API section.
        )r   )r:   ru   r"   r<   r   r   r   "get_recommendations_service_status  s    z0MWSConnection.get_recommendations_service_statusr      c             K   s   |  |||S )zbReturns a list of customer accounts based on search criteria that
           you specify.
        )r   )r:   ru   r"   r<   r   r   r   list_customers  s    zMWSConnection.list_customers2      c             K   s   |  |||S )zJReturns the next page of customers using the NextToken parameter.
        )r   )r:   ru   r"   r<   r   r   r   list_customers_by_next_token  s    z*MWSConnection.list_customers_by_next_tokenZCustomerIdListzCustomerIdList.CustomerIdc             K   s   |  |||S )zbReturns a list of customer accounts based on search criteria that
           you specify.
        )r   )r:   ru   r"   r<   r   r   r   get_customers_for_customer_id  s    z+MWSConnection.get_customers_for_customer_idc             K   s   |  |||S )z[Returns the operational status of the Customer Information API
           section.
        )r   )r:   ru   r"   r<   r   r   r   get_customerinfo_service_status  s    z-MWSConnection.get_customerinfo_service_statusZDateRangeStartr   c             K   s   |  |||S )zReturns a list of shopping carts in your Webstore that were last
           updated during the time range that you specify.
        )r   )r:   ru   r"   r<   r   r   r   
list_carts  s    zMWSConnection.list_cartsc             K   s   |  |||S )zZReturns the next page of shopping carts using the NextToken
           parameter.
        )r   )r:   ru   r"   r<   r   r   r   list_carts_by_next_token  s    z&MWSConnection.list_carts_by_next_tokenZ
CartIdListzCartIdList.CartIdc             K   s   |  |||S )zLReturns shopping carts based on the CartId values that you specify.
        )r   )r:   ru   r"   r<   r   r   r   	get_carts  s    zMWSConnection.get_cartsc             K   s   |  |||S )zLReturns the operational status of the Cart Information API section.
        )r   )r:   ru   r"   r<   r   r   r   get_cartinfo_service_status  s    z)MWSConnection.get_cartinfo_service_statusZDestinationT)rN   r      c             K   s   |  |||S )zMSpecifies a new destination where you want to receive notifications.
        )r   )r:   ru   r"   r<   r   r   r   register_destination  s    z"MWSConnection.register_destinationc             K   s   |  |||S )z]Removes an existing destination from the list of registered
           destinations.
        )r   )r:   ru   r"   r<   r   r   r   deregister_destination  s    z$MWSConnection.deregister_destinationc             K   s   |  |||S )zALists all current destinations that you have registered.
        )r   )r:   ru   r"   r<   r   r   r   list_registered_destinations  s    z*MWSConnection.list_registered_destinationsc             K   s   |  |||S )z>Sends a test notification to an existing destination.
        )r   )r:   ru   r"   r<   r   r   r   %send_test_notification_to_destination  s    z3MWSConnection.send_test_notification_to_destinationZSubscriptionc             K   s   |  |||S )zcCreates a new subscription for the specified notification type
           and destination.
        )r   )r:   ru   r"   r<   r   r   r   create_subscription  s    z!MWSConnection.create_subscriptionZNotificationTypec             K   s   |  |||S )z^Gets the subscription for the specified notification type and
           destination.
        )r   )r:   ru   r"   r<   r   r   r   get_subscription  s    zMWSConnection.get_subscriptionc             K   s   |  |||S )zaDeletes the subscription for the specified notification type and
           destination.
        )r   )r:   ru   r"   r<   r   r   r   delete_subscription
  s    z!MWSConnection.delete_subscriptionc             K   s   |  |||S )z:Returns a list of all your current subscriptions.
        )r   )r:   ru   r"   r<   r   r   r   list_subscriptions  s    z MWSConnection.list_subscriptionsc             K   s   |  |||S )zaUpdates the subscription for the specified notification type and
           destination.
        )r   )r:   ru   r"   r<   r   r   r   update_subscription  s    z!MWSConnection.update_subscriptionc             K   s   |  |||S )zIReturns the operational status of the Subscriptions API section.
        )r   )r:   ru   r"   r<   r   r   r    get_subscriptions_service_status#  s    z.MWSConnection.get_subscriptions_service_statusZAmazonOrderReferenceIdZOrderReferenceAttributesr   r5   c             K   s   |  |||S )ziSets order reference details such as the order total and a
           description for the order.
        )r   )r:   ru   r"   r<   r   r   r   set_order_reference_details)  s    z)MWSConnection.set_order_reference_detailsc             K   s   |  |||S )z[Returns details about the Order Reference object and its current
           state.
        )r   )r:   ru   r"   r<   r   r   r   get_order_reference_details2  s    z)MWSConnection.get_order_reference_detailsc             K   s   |  |||S )zConfirms that the order reference is free of constraints and all
           required information has been set on the order reference.
        )r   )r:   ru   r"   r<   r   r   r   confirm_order_reference:  s    z%MWSConnection.confirm_order_referencec             K   s   |  |||S )zwCancel an order reference; all authorizations associated with
           this order reference are also closed.
        )r   )r:   ru   r"   r<   r   r   r   cancel_order_referenceB  s    z$MWSConnection.cancel_order_referencec             K   s   |  |||S )zConfirms that an order reference has been fulfilled (fully
           or partially) and that you do not expect to create any new
           authorizations on this order reference.
        )r   )r:   ru   r"   r<   r   r   r   close_order_referenceJ  s    z#MWSConnection.close_order_referenceZAuthorizationReferenceIdZAuthorizationAmountc             K   s   |  |||S )zlReserves a specified amount against the payment method(s) stored in
           the order reference.
        )r   )r:   ru   r"   r<   r   r   r   	authorizeS  s    zMWSConnection.authorizeZAmazonAuthorizationIdc             K   s   |  |||S )zxReturns the status of a particular authorization and the total
           amount captured on the authorization.
        )r   )r:   ru   r"   r<   r   r   r   get_authorization_details]  s    z'MWSConnection.get_authorization_detailsZCaptureReferenceIdZCaptureAmountc             K   s   |  |||S )z>Captures funds from an authorized payment instrument.
        )r   )r:   ru   r"   r<   r   r   r   capturee  s    zMWSConnection.captureZAmazonCaptureIdc             K   s   |  |||S )zlReturns the status of a particular capture and the total amount
           refunded on the capture.
        )r   )r:   ru   r"   r<   r   r   r   get_capture_detailsm  s    z!MWSConnection.get_capture_detailsc             K   s   |  |||S )z!Closes an authorization.
        )r   )r:   ru   r"   r<   r   r   r   close_authorizationu  s    z!MWSConnection.close_authorizationZRefundReferenceIdZRefundAmountc             K   s   |  |||S )z.Refunds a previously captured amount.
        )r   )r:   ru   r"   r<   r   r   r   refund|  s    zMWSConnection.refundZAmazonRefundIdc             K   s   |  |||S )z3Returns the status of a particular refund.
        )r   )r:   ru   r"   r<   r   r   r   get_refund_details  s    z MWSConnection.get_refund_detailsc             K   s   |  |||S )zZReturns the operational status of the Off-Amazon Payments API
           section.
        )r   )r:   ru   r"   r<   r   r   r   $get_offamazonpayments_service_status  s    z2MWSConnection.get_offamazonpayments_service_status)r4   N)Nr4   ){ry   
__module____qualname__rQ   rR   r"   r   r   r   r   r   r   r   r   r   r   r   r   rm   rq   rM   rE   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rd   r   r   r   rp   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rn   ro   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r  r  r	  r
  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  __classcell__r   r   )r   r   r	     s  


	
			
	



&










	

        




 
 

 
)F)$Zxml.saxr   r   r   rU   Zboto.connectionr   Zboto.exceptionr   Zboto.mws.exceptionrQ   Zboto.mws.responseZboto.handlerr   Zboto.compatr   r   r   r   __all__rw   rJ   r'   r{   r.   rE   rM   rS   rd   rm   rn   ro   rp   rq   r   r	   r   r   r   r   <module>   sL   
