sunshine-conversations-python icon indicating copy to clipboard operation
sunshine-conversations-python copied to clipboard

Unable to run list_messages

Open tokihiko-tsurumoto opened this issue 11 months ago • 1 comments

When I ran the sample code, I get the following error.

module 'sunshine_conversations_client.model' has no attribute 'dict'

The sample code I ran is below.

from __future__ import print_function
import time
import sunshine_conversations_client
from sunshine_conversations_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.smooch.io
# See configuration.py for a list of all supported configuration parameters.
configuration = sunshine_conversations_client.Configuration(
    host = "https://api.smooch.io"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure HTTP basic authorization: basicAuth
configuration.username = 'YOUR_USERNAME'
configuration.password = 'YOUR_PASSWORD'

# Configure Bearer authorization (JWT): bearerAuth
# Uncomment this if you want to use JWTs
#configuration.access_token = 'YOUR_BEARER_TOKEN'

# Enter a context with an instance of the API client
with sunshine_conversations_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = sunshine_conversations_client.MessagesApi(api_client)
    app_id = '5d8cff3cd55b040010928b5b' # str | Identifies the app.
    conversation_id = '029c31f25a21b47effd7be90' # str | Identifies the conversation.
    page = sunshine_conversations_client.Page() # Page | Contains parameters for applying cursor pagination. (optional)

    try:
        # List Messages
        api_response = api_instance.list_messages(app_id, conversation_id, page=page)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling MessagesApi->list_messages: %s\n" % e)

tokihiko-tsurumoto avatar Mar 25 '25 08:03 tokihiko-tsurumoto

As a supplement, username, password, app_id and conversation_id were written for my environment.

tokihiko-tsurumoto avatar Mar 25 '25 08:03 tokihiko-tsurumoto