Goal: 
To read with an API and then write updates to a different API through a schedule on the gateway.
 Problem: 
Script will run in the script console but does not complete past the API in the Scheduled Gateway Event.
 Script Console: 
 Code Block: 
 Results: 
 Gateway Event - Scheduled 
 Script 
 Results: 
             
            
               
               
               
            
            
           
          
            
            
              Please post code - not pictures of code (unless the context is important, in which case post both) so we can copy them for testing or modification. Please see Wiki - how to post code on this forum .
             
            
               
               
              1 Like 
            
            
           
          
            
            
              Don't logger.error("some error" + str(e) - you lose the except trackback and cause information, the most valuable part.
Use logger.error("Some error", e), so that the exception goes through the automatic logging machinery and captures the stacktrace.
             
            
               
               
              6 Likes 
            
            
           
          
            
            
              Additionally, stuff this script into a Project Library Script  and put the initialization of the httpClient outside of any function definitions so you can reuse the same client instead of spawning a new one every time the function runs.
Something along the lines of:
import json
logger = system.util.getLogger("SmartSheetUpdate")
SHEET_HEADERS = {}
SHEET_URL = "https://some url here"
sheetClient = system.net.httpClient()
def abc(payload):
	""" """
	
	response = sheetClient.get(url=SHEET_URL, headers=SHEET_HEADERS)
 
             
            
               
               
              2 Likes 
            
            
           
          
            
              
                pturmel  
                
               
              
                  
                    February 20, 2025,  8:43pm
                   
                   
              5 
               
             
            
              Once  in a project library, you may want to install my Integration Toolkit and do this:
@system.util.runInGateway
def abc(payload):
	...
 
... so you can call it in the designer but it will run in the gateway.  And you'll likely be able to see what is wrong.
(Designer scope is a variant of Vision Client scope--not related to Gateway Scope at all.)
             
            
               
               
              1 Like 
            
            
           
          
            
            
              Where do I find this integration toolkit?
             
            
               
               
               
            
            
           
          
            
            
              I did this definitely much easier
             
            
               
               
               
            
            
           
          
            
              
                pturmel  
                
               
              
                  
                    February 21, 2025, 10:10pm
                   
                   
              8 
               
             
            
              
  
  
    Automation Professionals is pleased to announce the immediately availability of a major upgrade to its free Simulation Aids Integration Toolkit module.  The new feature justifying the "major upgrade" language is the implementation of eleven thirty-one new expression functions which use iteration to accomplish complex transforms of datasets and lists, to or from other datasets and lists, applying filtering, ordering, and computed new columns along the way.  While there are certain operations that…
   
 
And then to my Module Sales  page. (But this one is free.)
             
            
               
               
              1 Like 
            
            
           
          
            
            
              My issue is our network firewall.
             
            
               
               
              2 Likes