Skip to main content
Question

Webhook returning status 401, but only on one computer and only with certain webhooks


I have some python code that uploads a file to FME Server and then runs a webhook

 

 

filename = outfile
_file = os.path.basename(filename)
token = ""
fmehndlr = FMEHandler.FMEHandlerClass()
fmehndlr.filename = _file 
## set token
fmehndlr.token = token
## set upload location
fmehndlr.upurl = "http://000.00.0.103:8080/fmerest/v3/resources/connections/FME_SHAREDRESOURCE_TEMP/filesys"
#### set parameter values
rowtype = name.replace(" ",'%20')
projectname = project.replace(" ",'%20')
projectnumber = projectnum.replace(" ",'%20')
scale = "1000"
dwgname = _file.replace('.gdb',"").replace('.zip',"")+".dwg"
dwgpath = os.path.join(projectfolder,dwgname)
## url for webhook with parameters in it, you have to set this before upload if used with the AP41 flag
fmehndlr.runurl = f"http://000.00.0:8080/fmedatastreaming/PlatFactory/conchoEasementCenterline.fmw?TEMPLATE=%24(FME_MF_DIR)CONCHO_TEMPLATE_CENTERLINE_EASEMENT.dwg&SCALE={scale}&SourceDataset_FILEGDB=%24(FME_SHAREDRESOURCE_TEMP)%2F{_file}&SPACE=PAGE%202%20OF%202&WIDTH={str(width)}&EASEMENT_TYPE={rowtype}&PROJECT_NAME={projectname}&PROJECT_NUMBER={projectnumber}&token=token"
### upload and print response status
resp = fmehndlr.upload(filename)
arcpy.AddMessage(resp.status_code)
if resp.status_code==201:
## run webhook and catch response
    resp = fmehndlr.runwebhook()
    arcpy.AddMessage(resp.status_code)
    if resp.status_code==200:
        fmehndlr.savefilestream(dwgpath,resp)

 

This code works fine on my machine but when I run it from another computer, after the file is uploaded to FME Server the webhook fails. This is what I don't understand, if the file is uploaded successfully and returns status 201 why is FME then refusing the webhook and returning status 401?

0 replies

Be the first to reply!

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