:doc:`SageMaker <../../sagemaker>` / Client / list_contexts

*************
list_contexts
*************



.. py:method:: SageMaker.Client.list_contexts(**kwargs)

  

  Lists the contexts in your account and their properties.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/sagemaker-2017-07-24/ListContexts>`_  


  **Request Syntax**
  ::

    response = client.list_contexts(
        SourceUri='string',
        ContextType='string',
        CreatedAfter=datetime(2015, 1, 1),
        CreatedBefore=datetime(2015, 1, 1),
        SortBy='Name'|'CreationTime',
        SortOrder='Ascending'|'Descending',
        NextToken='string',
        MaxResults=123
    )
    
  :type SourceUri: string
  :param SourceUri: 

    A filter that returns only contexts with the specified source URI.

    

  
  :type ContextType: string
  :param ContextType: 

    A filter that returns only contexts of the specified type.

    

  
  :type CreatedAfter: datetime
  :param CreatedAfter: 

    A filter that returns only contexts created on or after the specified time.

    

  
  :type CreatedBefore: datetime
  :param CreatedBefore: 

    A filter that returns only contexts created on or before the specified time.

    

  
  :type SortBy: string
  :param SortBy: 

    The property used to sort results. The default value is ``CreationTime``.

    

  
  :type SortOrder: string
  :param SortOrder: 

    The sort order. The default value is ``Descending``.

    

  
  :type NextToken: string
  :param NextToken: 

    If the previous call to ``ListContexts`` didn't return the full set of contexts, the call returns a token for getting the next set of contexts.

    

  
  :type MaxResults: integer
  :param MaxResults: 

    The maximum number of contexts to return in the response. The default value is 10.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'ContextSummaries': [
              {
                  'ContextArn': 'string',
                  'ContextName': 'string',
                  'Source': {
                      'SourceUri': 'string',
                      'SourceType': 'string',
                      'SourceId': 'string'
                  },
                  'ContextType': 'string',
                  'CreationTime': datetime(2015, 1, 1),
                  'LastModifiedTime': datetime(2015, 1, 1)
              },
          ],
          'NextToken': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **ContextSummaries** *(list) --* 

        A list of contexts and their properties.

        
        

        - *(dict) --* 

          Lists a summary of the properties of a context. A context provides a logical grouping of other entities.

          
          

          - **ContextArn** *(string) --* 

            The Amazon Resource Name (ARN) of the context.

            
          

          - **ContextName** *(string) --* 

            The name of the context.

            
          

          - **Source** *(dict) --* 

            The source of the context.

            
            

            - **SourceUri** *(string) --* 

              The URI of the source.

              
            

            - **SourceType** *(string) --* 

              The type of the source.

              
            

            - **SourceId** *(string) --* 

              The ID of the source.

              
        
          

          - **ContextType** *(string) --* 

            The type of the context.

            
          

          - **CreationTime** *(datetime) --* 

            When the context was created.

            
          

          - **LastModifiedTime** *(datetime) --* 

            When the context was last modified.

            
      
    
      

      - **NextToken** *(string) --* 

        A token for getting the next set of contexts, if there are any.

        
  
  **Exceptions**
  
  *   :py:class:`SageMaker.Client.exceptions.ResourceNotFound`

  