Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bonk1t committed Dec 28, 2023
1 parent f7a000a commit 1c9e14d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions nalgonda/custom_tools/save_lead_to_airtable.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import logging

from agency_swarm import BaseTool
from pyairtable import Api
from pydantic import Field

from nalgonda.settings import settings

logger = logging.getLogger(__name__)


class SaveLeadToAirtable(BaseTool):
"""Save a new lead to Airtable."""
Expand All @@ -14,7 +18,7 @@ class SaveLeadToAirtable(BaseTool):

def run(self) -> str:
"""Save a new lead to Airtable."""
self.logger.info(f"Saving new lead to Airtable: {self.name}, {self.email}, {self.phone}, {self.lead_details}")
logger.info(f"Saving new lead to Airtable: {self.name}, {self.email}, {self.lead_details}")

try:
api = Api(settings.airtable_token)
Expand All @@ -30,8 +34,8 @@ def run(self) -> str:
airtable_message = f"Response from Airtable: id: {response['id']}, createdTime: {response['createdTime']}"
except Exception as e:
airtable_message = f"Error while saving lead to Airtable: {e}"
self.logger.exception(airtable_message)
logger.exception(airtable_message)

self.logger.info(airtable_message)
logger.info(airtable_message)

return airtable_message

0 comments on commit 1c9e14d

Please sign in to comment.