Skip to main content
  • 1,225 Posts
  • 4,345 Replies
1225 Posts
Why would Urllib.request.urlopen return b'' when running a webhook?

I am trying to run webhooks on FME Server. The webhooks run successfully and I get status code 200 from the server but when I check the length of the data in the response it is 0, in this case 0. Is there a header I am missing?from urllib.request import urlopenfrom shutil import copyfileobjdef runwebhook(runurl):    response = urlopen(runurl)    if response.getcode()==200:        print("Success")    return responsedef savefilestream(filepath,response):    if exists(filepath): remove(filepath)    if isinstance(response.read(),bytes)==True:        with open(filepath,'wb') as f:            data = len(response.read())            print(data)            copyfileobj(response, f)            f.close()            print("File Saved Successfully")    else:        with open(filepath,'w') as f:            f.write(str(response.read()))

Badge Winners

Show all badges

Community Stats

32,324
Posts
123,122
Replies
40,342
Members