U
    W+d                     @   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)
2010-10-01r   z&/FulfillmentInboundShipment/2010-10-01)r   r   z'/FulfillmentOutboundShipment/2010-10-01)r   r   z /FulfillmentInventory/2010-10-01)z
2013-04-01r   z/Recommendations/2013-04-01)
2014-03-01r   z/CustomerInformation/2014-03-01)r   r   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   hashlibmd5digeststrip)c r"   7/tmp/pip-unpacked-wheel-dlxw5sjy/boto/mws/connection.py<lambda>9       r$   )actionresponsesectionquotarestoreversionc                 C   s(   t D ]}t||t| |d  q| |_|S r   )decorated_attrssetattrgetattr__wrapped__)functoattrr"   r"   r#   add_attrs_from?   s    r3   c                     s    fdd}|S )Nc                    s0    fdd}d  jd|_t |dS )Nc                    s   dd  D D ]d\}}||kr|d | |r0dp2d }t t|| D ] }|| | ||t|d  < qF|| q| 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>r4       )rangelenstrpop)selfargskwkeyaccZnewkeyifieldsr0   r"   r#   wrapperJ   s    z4structured_lists.<locals>.decorator.<locals>.wrapperz{0}
Lists: {1}, r1   format__doc__joinr3   r0   rH   rG   r0   r#   	decoratorH   s
    z#structured_lists.<locals>.decoratorr"   rG   rR   r"   rP   r#   structured_listsF   s    rT   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"   r6   rB   r"   r#   r9   ]   s     zAhttp_body.<locals>.decorator.<locals>.wrapper.<locals>.<listcomp>content_typezB{0} requires {1} and content_type arguments for building HTTP bodybody)Content-TypeContent-MD5headers)anyrL   r&   KeyErrorr?   content_md5rA   rB   message)fieldr0   rU   r#   rH   \   s     

z-http_body.<locals>.decorator.<locals>.wrapperz{0}
Required HTTP Body: {1}rJ   )rL   rM   r3   rO   r`   rQ   r#   rR   Z   s     zhttp_body.<locals>.decoratorr"   )r`   rR   r"   ra   r#   	http_bodyX   s    rb   Fc                 C   s   t | tjjjr$t| j|||d nt | tjrd| D ],}|	drDq4t| | ||d | |d q4nt | t
jrz| ||< npt | tjrt| D ]4\}}|rdpdt|d  }t|||| |d qn$t | trt|  ||< n| ||< d S )Nmembers_r4   z.member.r;   )
isinstancebotomwsr'   ZResponseElementdestructure_object__dict__collectionsMapping
startswithr   string_typesIterable	enumerater>   boollower)valueZintoprefixrd   nameindexelementsuffixr"   r"   r#   ri   m   s(    




ri   c                     s    fdd}|S )Nc                    s2    fdd}d  jd|_t |dS )Nc                     sD    dd}t fddD ]}t | ||d q|  S )Nrd   Fc                    s   |  kS r   r"   )rE   rU   r"   r#   r$      r%   zHstructured_objects.<locals>.decorator.<locals>.wrapper.<locals>.<lambda>rc   )getr   ri   r?   )rA   rB   rd   r`   )rG   r0   kwargsrU   r#   rH      s    z6structured_objects.<locals>.decorator.<locals>.wrapperzJ{0}
Element|Iter|Map: {1}
(ResponseElement or anything iterable/dict-like)rI   rJ   rK   rO   rG   rz   rQ   r#   rR      s     z%structured_objects.<locals>.decoratorr"   )rG   rz   rR   r"   r{   r#   structured_objects   s    r|   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 r   r"   r7   rC   rU   r"   r#   	<genexpr>   s     zRrequires.<locals>.decorator.<locals>.requires.<locals>.<lambda>.<locals>.<genexpr>allgrouprU   r"   r#   r$      r%   z?requires.<locals>.decorator.<locals>.requires.<locals>.<lambda>r;    OR c                 S   s   g | ]}d  |qS +rN   r7   gr"   r"   r#   r9      s     zArequires.<locals>.decorator.<locals>.requires.<locals>.<listcomp>z{0} requires {1} argument(s)r=   listr   rN   rL   r&   r\   rA   rB   hasgroupr_   r0   groupsrU   r#   requires   s     z-requires.<locals>.decorator.<locals>.requiresr   c                 S   s   g | ]}d  |qS r   r   r   r"   r"   r#   r9      s     z/requires.<locals>.decorator.<locals>.<listcomp>z{0}
Required: {1}rJ   rN   rL   rM   r3   )r0   r   r_   r   rQ   r#   rR      s    zrequires.<locals>.decoratorr"   r   rR   r"   r   r#   r      s    r   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 r   r"   r}   rU   r"   r#   r~      s     zRexclusive.<locals>.decorator.<locals>.wrapper.<locals>.<lambda>.<locals>.<genexpr>r   r   rU   r"   r#   r$      r%   z?exclusive.<locals>.decorator.<locals>.wrapper.<locals>.<lambda>)r   r;   r   c                 S   s   g | ]}d  |qS r   r   r   r"   r"   r#   r9      s     zAexclusive.<locals>.decorator.<locals>.wrapper.<locals>.<listcomp>z{0} requires either {1}r   r   r   rU   r#   rH      s     z-exclusive.<locals>.decorator.<locals>.wrapperr   c                 S   s   g | ]}d  |qS r   r   r   r"   r"   r#   r9      s     z0exclusive.<locals>.decorator.<locals>.<listcomp>z{0}
Either: {1}rJ   r   r0   rH   r_   r   rQ   r#   rR      s    zexclusive.<locals>.decoratorr"   r   r"   r   r#   	exclusive   s    r   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 r   r"   r}   rU   r"   r#   r~      s     zRdependent.<locals>.decorator.<locals>.wrapper.<locals>.<lambda>.<locals>.<genexpr>r   r   rU   r"   r#   r$      r%   z?dependent.<locals>.decorator.<locals>.wrapper.<locals>.<lambda>c                 3   s   | ]} |V  qd S r   r"   r   )r   r"   r#   r~      s     z@dependent.<locals>.decorator.<locals>.wrapper.<locals>.<genexpr>r   c                 S   s   g | ]}d  |qS r   r   r   r"   r"   r#   r9      s     zAdependent.<locals>.decorator.<locals>.wrapper.<locals>.<listcomp>z{0} argument {1} requires {2})r[   rN   rL   r&   r\   r^   )r`   r0   r   )r   rB   r#   rH      s      z-dependent.<locals>.decorator.<locals>.wrapperr   c                 S   s   g | ]}d  |qS r   r   r   r"   r"   r#   r9      s     z0dependent.<locals>.decorator.<locals>.<listcomp>z{0}
{1} requires: {2}rJ   r   r   r`   r   rQ   r#   rR      s    zdependent.<locals>.decoratorr"   )r`   r   rR   r"   r   r#   	dependent   s    r   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 r   r"   r7   rE   rU   r"   r#   r~      s     zHrequires_some_of.<locals>.decorator.<locals>.requires.<locals>.<genexpr>z,{0} requires at least one of {1} argument(s)rI   )r[   rL   r&   rN   r\   r^   rF   rU   r#   r      s     z5requires_some_of.<locals>.decorator.<locals>.requiresz{0}
Some Required: {1}rI   rJ   rK   )r0   r   rP   rQ   r#   rR      s
    z#requires_some_of.<locals>.decoratorr"   rS   r"   rP   r#   requires_some_of   s    r   c                     s    fdd}|S )Nc                    s0    fdd}d  jd|_t |dS )Nc                     s6    fddD D ]}t  |   |< q|  S )Nc                    s    g | ]}t  |tr|qS r"   )rf   ry   rq   r6   rU   r"   r#   r9      s      zIboolean_arguments.<locals>.decorator.<locals>.wrapper.<locals>.<listcomp>)r>   rr   )rA   rB   r`   rF   rU   r#   rH      s    z5boolean_arguments.<locals>.decorator.<locals>.wrapperz{0}
Booleans: {1}rI   rJ   rK   rO   rP   rQ   r#   rR      s
    z$boolean_arguments.<locals>.decoratorr"   rS   r"   rP   r#   boolean_arguments   s    	r   c                    s    t |t|f fdd	}|S )Nc                    s   t  \ dp(ttjjd fdd}tD ]}t||t	 
| qHdj|_jt< |S )Nr:   re   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?ActionVersion)
connection)pathr)   r*   )
setdefaultr.   rL   r\   Z_response_factorydict)r@   rA   rB   r_   r'   requestZ	accesskeyr&   r0   r   r)   r*   r+   r"   r#   rH      s      z.api_action.<locals>.decorator.<locals>.wrapperz3MWS {0}/{1} API call; quota={2} restore={3:.2f}
{4})api_version_pathrN   r   r>   
capitalize__name__r5   r,   r-   localsry   rL   rM   api_call_map)r0   r)   r*   rH   r2   apir(   r   r#   rR      s       
zapi_action.<locals>.decorator)intfloat)r(   r)   r*   r   rR   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)
r   r?   
_sandboxedry   r
   r   _setup_factoriessuperr	   __init__)r@   rA   rB   	__class__r"   r#   r     s    zMWSConnection.__init__c                 K   st   t jj| jft jj| jfd D ]L\}\}}||krNt| d| || q"||g }t| d| ||d q"|S )N)Zresponse_factoryZresponse_error_factoryre   )scopes)	rg   rh   r'   ResponseFactory	exceptionResponseErrorFactoryitemsr-   r?   )r@   ZextrascopesrB   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   r5   rN   )r@   r   Zsplatr"   r"   r#   _sandboxify"  s
    
zMWSConnection._sandboxifyc                 C   s   dgS )Nrh   r"   )r@   r"   r"   r#   _required_auth_capability)  s    z'MWSConnection._required_auth_capabilityr:   Nc              
   C   s6  |pi }|  |d }| jd|d|||| jd}z| j|dd}W n6 tk
rx } z| |j|j|jW 5 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.
        r   POSTN)dataparamsrZ   r   )Zoverride_num_retrieszNull body %s   z%s %sz%srY   rX   )r   Zbuild_base_http_requestr   Z_mexer   Z_response_error_factorystatusreasonrW   readrg   logdebugerror	getheaderr]   AssertionError_parse_response)r@   r   r   parserrW   rZ   r   r'   bsr   contenttyper"   r"   r#   _post_request,  s>     & 
 


zMWSConnection._post_requestc                 C   s*   | ds|S t|| }tj|| |S )Nztext/xml)rm   r   xmlsaxparseString)r@   r   r   rW   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
        re   N)stringcapwordsr   r.   )r@   ru   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   rL   iter_response)r@   callrA   rB   methodr"   r"   r#   	iter_call[  s    
zMWSConnection.iter_callc                 c   s@   |V  |  |jd }|r<|jjdkr<||jjd}|V  q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   _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.
        )rW   rZ   r   )r@   r   r'   rZ   rW   rB   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@   r   r'   rB   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   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   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   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   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.
        rI   zTUse {0}.get_(section)_service_status(), where (section) is one of the following: {1}N)
rN   r   r>   rr   r   keysrL   r   r   AttributeError)r@   rB   sectionsr_   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   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   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   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   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   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   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   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   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   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   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   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   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   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   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   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   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   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   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   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   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   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   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   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   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   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   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   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   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   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   r"   r"   r#   list_all_fulfillment_orders  s    z)MWSConnection.list_all_fulfillment_ordersc                 K   s   |  |||S r  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   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   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                    sv   t d}|dg|dgd D ]@\} ||kr&t fdd|D r&dd |}t|q&| |||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 r   r"   r   Zdontr"   r#   r~     s     z,MWSConnection.list_orders.<locals>.<genexpr>z%Don't include {0} when specifying {1}z or )setunionr   r[   rL   rN   r   r   )r@   r   r'   rB   ZtoggleZdor_   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   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   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   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   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   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   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   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   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   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   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   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   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   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   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   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   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   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   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   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   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   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   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   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   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   r"   r"   r#   list_customers_by_next_token  s    z*MWSConnection.list_customers_by_next_tokenZCustomerIdListzCustomerIdList.CustomerIdc                 K   s   |  |||S r3  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   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   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   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   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   r"   r"   r#   get_cartinfo_service_status  s    z)MWSConnection.get_cartinfo_service_statusZDestinationTrc   r      c                 K   s   |  |||S )zMSpecifies a new destination where you want to receive notifications.
        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   r"   r"   r#   deregister_destination  s    z$MWSConnection.deregister_destinationc                 K   s   |  |||S )zALists all current destinations that you have registered.
        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   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   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   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   r"   r"   r#   delete_subscription
  s    z!MWSConnection.delete_subscriptionc                 K   s   |  |||S )z:Returns a list of all your current subscriptions.
        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   r"   r"   r#   update_subscription  s    z!MWSConnection.update_subscriptionc                 K   s   |  |||S )zIReturns the operational status of the Subscriptions API section.
        r   r   r"   r"   r#    get_subscriptions_service_status#  s    z.MWSConnection.get_subscriptions_service_statusZAmazonOrderReferenceIdZOrderReferenceAttributesr   r;   c                 K   s   |  |||S )ziSets order reference details such as the order total and a
           description for the order.
        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   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   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   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   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   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   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   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   r"   r"   r#   get_capture_detailsm  s    z!MWSConnection.get_capture_detailsc                 K   s   |  |||S )z!Closes an authorization.
        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   r"   r"   r#   refund|  s    zMWSConnection.refundZAmazonRefundIdc                 K   s   |  |||S )z3Returns the status of a particular refund.
        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   r"   r"   r#   $get_offamazonpayments_service_status  s    z2MWSConnection.get_offamazonpayments_service_status)r:   N)Nr:   ){r   
__module____qualname__rg   rh   r'   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rb   rT   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"  r#  r%  r&  r'  r(  r)  r*  r+  r,  r-  r.  r/  r0  r1  r4  r7  r8  r9  r:  r;  r<  r=  r?  r@  rA  rB  rC  rD  rE  rF  rG  rH  rI  rJ  rK  rL  rM  rN  rO  rP  rQ  rR  rS  rT  rU  __classcell__r"   r"   r   r#   r	     s  


	





	






























  








 






















	


















)F)$Zxml.saxr   r   r   rk   Zboto.connectionr   Zboto.exceptionr   Zboto.mws.exceptionrg   Zboto.mws.responseZboto.handlerr   Zboto.compatr   r   r   r   __all__r   r]   r,   r   r3   rT   rb   ri   r|   r   r   r   r   r   r   r	   r"   r"   r"   r#   <module>   sN   
