API is not working

API is not working

Hello,

I'm working on a requirement to fetch data from Zoho and load into MySQL. Earlier the get_records() , get_instances() for individual modules were working but now it's giving me error as below, even though I refresh the token and reconnect. Please check on priority and assist me on the same :


Traceback (most recent call last):
  File "C:\Users\Amitkumarsahu\AppData\Local\Programs\Python\Python37-32\lib\site-packages\zcrmsdk\OAuthClient.py", line 139, in get_access_token
    return oAuthTokens.get_access_token()
  File "C:\Users\Amitkumarsahu\AppData\Local\Programs\Python\Python37-32\lib\site-packages\zcrmsdk\OAuthClient.py", line 230, in get_access_token
    raise ZohoOAuthException("Access token got expired!")
zcrmsdk.OAuthUtility.ZohoOAuthException: Access token got expired!

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Amitkumarsahu\AppData\Local\Programs\Python\Python37-32\lib\site-packages\zcrmsdk\OAuthClient.py", line 141, in get_access_token
    OAuthLogger.add_log("Access token expired hence refreshing",logging.INFO,e)
  File "C:\Users\Amitkumarsahu\AppData\Local\Programs\Python\Python37-32\lib\site-packages\zcrmsdk\OAuthUtility.py", line 151, in add_log
    fileHandler=logging.FileHandler(log_path)
  File "C:\Users\Amitkumarsahu\AppData\Local\Programs\Python\Python37-32\lib\logging\__init__.py", line 1087, in __init__
    StreamHandler.__init__(self, self._open())
  File "C:\Users\Amitkumarsahu\AppData\Local\Programs\Python\Python37-32\lib\logging\__init__.py", line 1116, in _open
    return open(self.baseFilename, self.mode, encoding=self.encoding)
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Amitkumarsahu\\OneDrive - Aspirenxt Pvt Ltd\\Desktop\\Zoho_CRM_Data\\Scripts\\log\\oauth.log'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Amitkumarsahu\AppData\Local\Programs\Python\Python37-32\lib\site-packages\zcrmsdk\Request.py", line 62, in get_bulk_api_response
    self.authenticate_request()
  File "C:\Users\Amitkumarsahu\AppData\Local\Programs\Python\Python37-32\lib\site-packages\zcrmsdk\Request.py", line 38, in authenticate_request
    accessToken=ZCRMConfigUtil.get_instance().get_access_token()
  File "C:\Users\Amitkumarsahu\AppData\Local\Programs\Python\Python37-32\lib\site-packages\zcrmsdk\Utility.py", line 230, in get_access_token
    return clientIns.get_access_token(userEmail)
  File "C:\Users\Amitkumarsahu\AppData\Local\Programs\Python\Python37-32\lib\site-packages\zcrmsdk\OAuthClient.py", line 145, in get_access_token
    OAuthLogger.add_log("Exception occured while fetching oauthtoken from db",logging.ERROR,ex)
  File "C:\Users\Amitkumarsahu\AppData\Local\Programs\Python\Python37-32\lib\site-packages\zcrmsdk\OAuthUtility.py", line 151, in add_log
    fileHandler=logging.FileHandler(log_path)
  File "C:\Users\Amitkumarsahu\AppData\Local\Programs\Python\Python37-32\lib\logging\__init__.py", line 1087, in __init__
    StreamHandler.__init__(self, self._open())
  File "C:\Users\Amitkumarsahu\AppData\Local\Programs\Python\Python37-32\lib\logging\__init__.py", line 1116, in _open
    return open(self.baseFilename, self.mode, encoding=self.encoding)
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Amitkumarsahu\\OneDrive - Aspirenxt Pvt Ltd\\Desktop\\Zoho_CRM_Data\\Scripts\\log\\oauth.log'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Amitkumarsahu\AppData\Local\Programs\Python\Python37-32\lib\site-packages\zcrmsdk\Handler.py", line 854, in get_records
    bulk_api_response=APIRequest(handler_ins).get_bulk_api_response()
  File "C:\Users\Amitkumarsahu\AppData\Local\Programs\Python\Python37-32\lib\site-packages\zcrmsdk\Request.py", line 74, in get_bulk_api_response
    CommonUtil.raise_exception(self.url,ex.message,traceback.format_stack())
AttributeError: 'FileNotFoundError' object has no attribute 'message'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users/Amitkumarsahu/OneDrive - Aspirenxt Pvt Ltd/Desktop/Zoho_CRM_Data/Scripts/deals.py", line 26, in <module>
    resp = module_ins.get_records()
  File "C:\Users\Amitkumarsahu\AppData\Local\Programs\Python\Python37-32\lib\site-packages\zcrmsdk\Operations.py", line 64, in get_records
    return MassEntityAPIHandler.get_instance(self).get_records(cvid,sort_by,sort_order,page,per_page)
  File "C:\Users\Amitkumarsahu\AppData\Local\Programs\Python\Python37-32\lib\site-packages\zcrmsdk\Handler.py", line 874, in get_records
    CommonUtil.raise_exception(handler_ins.request_url_path,ex.message,traceback.format_stack())
AttributeError: 'AttributeError' object has no attribute 'message'

Process finished with exit code 1


Thanks & Regards,
Amit Kumar

    Access your files securely from anywhere









                          Zoho Developer Community




                                                • Desk Community Learning Series


                                                • Digest


                                                • Functions


                                                • Meetups


                                                • Kbase


                                                • Resources


                                                • Glossary


                                                • Desk Marketplace


                                                • MVP Corner


                                                • Word of the Day


                                                • Ask the Experts





                                                          Manage your brands on social media



                                                                Zoho TeamInbox Resources



                                                                    Zoho CRM Plus Resources

                                                                      Zoho Books Resources


                                                                        Zoho Subscriptions Resources

                                                                          Zoho Projects Resources


                                                                            Zoho Sprints Resources


                                                                              Qntrl Resources


                                                                                Zoho Creator Resources



                                                                                    Zoho CRM Resources

                                                                                    • CRM Community Learning Series

                                                                                      CRM Community Learning Series


                                                                                    • Kaizen

                                                                                      Kaizen

                                                                                    • Functions

                                                                                      Functions

                                                                                    • Meetups

                                                                                      Meetups

                                                                                    • Kbase

                                                                                      Kbase

                                                                                    • Resources

                                                                                      Resources

                                                                                    • Digest

                                                                                      Digest

                                                                                    • CRM Marketplace

                                                                                      CRM Marketplace

                                                                                    • MVP Corner

                                                                                      MVP Corner







                                                                                        Design. Discuss. Deliver.

                                                                                        Create visually engaging stories with Zoho Show.

                                                                                        Get Started Now


                                                                                          Zoho Show Resources

                                                                                            Zoho Writer

                                                                                            Get Started. Write Away!

                                                                                            Writer is a powerful online word processor, designed for collaborative work.

                                                                                              Zoho CRM コンテンツ






                                                                                                Nederlandse Hulpbronnen


                                                                                                    ご検討中の方