U
    W+dQ                     @   sh   d dl Z d dlmZmZ d dlmZ d dlZd dlZd dlZ	d dl
mZ d dl mZ G dd deZdS )    N)AWSQueryConnectionAWSAuthConnection)BotoServerError)ItemSet)handlerc                       sH   e Zd ZdZdZd fdd		Zd
d ZdddZdd Zdd Z	  Z
S )ECSConnectionz
    ECommerce Connection

    For more information on how to use this module see:

    http://blog.coredumped.org/2010/09/search-for-books-on-amazon-using-boto.html
    z
2010-11-01NTecs.amazonaws.comr   /c                    s0   t t| j|||||||||	|
||||d d S )N)security_tokenprofile_name)superr   __init__)selfZaws_access_key_idZaws_secret_access_keyZ	is_secureportproxyZ
proxy_portZ
proxy_userZ
proxy_passhostdebugZhttps_connection_factorypathr
   r   	__class__ 5/tmp/pip-unpacked-wheel-dlxw5sjy/boto/ecs/__init__.pyr   *   s            zECSConnection.__init__c                 C   s   dgS )NZecsr   )r   r   r   r   _required_auth_capability5   s    z'ECSConnection._required_auth_capabilityc           	      C   s   d|d< ||d< |r||d< |  d|d}| d}tj| |jdkrtjd	|j|jf  tjd
|  t	|j|j||dkrt
| |||}n|}t|| }tj|d| |jst	|jdjf |jd |S )zQ
        Utility method to handle calls to ECS and parsing of responses.
        ZAWSECommerceServiceZServiceZ	OperationZItemPageNz	/onca/xmlzutf-8   z%s %sz%sz{Code}: {Message}r   )Zmake_requestreaddecodebotologr   statuserrorreasonr   r   r   Z
XmlHandlerxmlsaxparseStringencodeZis_validformaterrors)	r   actionparamspageZitemSetresponsebodyrshr   r   r   get_response8   s&    
zECSConnection.get_responsec                 K   s   ||d< |  d|S )a  
        Returns items that satisfy the search criteria, including one or more search
        indices.

        For a full list of search terms,
        :see: http://docs.amazonwebservices.com/AWSECommerceService/2010-09-01/DG/index.html?ItemSearch.html
        ZSearchIndexZ
ItemSearchr.   )r   Zsearch_indexr(   r   r   r   item_searchW   s    zECSConnection.item_searchc                 K   s   |  d|S )z
        Returns items that satisfy the lookup query.

        For a full list of parameters, see:
        http://s3.amazonaws.com/awsdocs/Associates/2011-08-01/prod-adv-api-dg-2011-08-01.pdf
        Z
ItemLookupr/   )r   r(   r   r   r   item_lookupb   s    zECSConnection.item_lookup)NNTNNNNNr   r   Nr	   NN)r   N)__name__
__module____qualname____doc__Z
APIVersionr   r   r.   r0   r1   __classcell__r   r   r   r   r      s(                        
r   )r   Zboto.connectionr   r   Zboto.exceptionr   timeurllibZxml.saxr!   Zboto.ecs.itemr   r   r   r   r   r   r   <module>   s   