Skip to main content
Question

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

  • June 29, 2020
  • 0 replies
  • 10 views

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?

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.