Skip to main content
Solved

Accessing FME Feature Attributes within a Python Caller


crowleyb
Contributor
Forum|alt.badge.img+4

I am using a pythoncaller to access Zoom API to download unique meeting IDs.

 

The code is:

import ssl
 
import http.client
 
import zipfile
 
import fme
 
import fmeobjects
 
# Template Function interface:
 
# When using this function, make sure its name is set as the value of
 
# the 'Class or Function to Process Features' transformer parameter
 
def processFeature(feature):
 
  pass
 
 
 
# Template Class Interface:
 
# When using this class, make sure its name is set as the value of
 
# the 'Class or Function to Process Features' transformer parameter
 
class FeatureProcessor(object):
 
  def __init__(self):
 
    pass
 
  def input(self,feature):
 
    self.pyoutput(feature)
 
  def close(self):
 
    pass
 
 
 
#Setting User Parameters
 
MeetingID = "?????????"
 
 
 
conn.request("GET""/v2/past_meetings/"+ MeetingID +"/instances", headers=headers)

What I would like to do is set MeetingID to feature.getAttribute('SCO_Zoom_Meeting_ID__c') where that is a value returned from a query from my database. 

 

I would appreciate any help. If I just set MeetingID = feature.getAttribute('SCO_Zoom_Meeting_ID__c') it errors saying 'feature' is not defined.

 

Best answer by hkingsbury

The python caller will either call a class (line 29) or a function (line 17). From what I can guess from your scenario all you'll need is to use the function. This will get called once for each feature that gets passed through the transformer.

In that function is where you write your code, so line 47 onwards needs to be encapsulated in that function.

You will also need to set the transformer to call that function. There is a box at hte top of the window where you enter the function or class name. By default it is the class

View original
Did this help you find an answer to your question?

2 replies

hkingsbury
Celebrity
Forum|alt.badge.img+55
  • Celebrity
  • Best Answer
  • May 19, 2021

The python caller will either call a class (line 29) or a function (line 17). From what I can guess from your scenario all you'll need is to use the function. This will get called once for each feature that gets passed through the transformer.

In that function is where you write your code, so line 47 onwards needs to be encapsulated in that function.

You will also need to set the transformer to call that function. There is a box at hte top of the window where you enter the function or class name. By default it is the class


crowleyb
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • May 19, 2021

Great! Thank you. That worked @hkingsbury​ 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings