Solved

HTTPcaller: Number of redirects hit maximum, Pythoncaller url request does work

  • 14 June 2019
  • 2 replies
  • 14 views

I want to collect the _response_body of a certain website ( for example https://www.odnzkg.nl/mozard/!suite86.scherm0325?mPag=636 ). Normally the HTTPcaller or HTML tabel in a FeatureReader does the trick. However, by trying this on the url posted above it returns

 

HTTPCaller(HTTPFactory): HTTP/FTP transfer error: 'Number of redirects hit maximum amount'
HTTPCaller(HTTPFactory): Please ensure that your network connection is properly set up
HTTPCaller(HTTPFactory): No proxy settings have been entered.  If you require a proxy to access external URLs, please ensure the appropriate information has been entered

 

I already tried it at different networks to check if it is a proxy error. When I try to retrieve the HTML code using a PythonCaller it returns the required response_body

 

import fme
import fmeobjects
import requests as req
# 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):
    url = 'https://www.odnzkg.nl/mozard/!suite86.scherm0325?mPag=636'
    resp = req.get(url)
    print('Response_body: ' + resp.text)
    
    feature.setAttribute("httpBody", resp.text)
    
    
    pass 

Does somebody know the reason that it works via Python? Does it have something to do with the way the url request is formulated?

 

Thanks in advance,

Bart

icon

Best answer by david_r 14 June 2019, 14:54

View original

2 replies

Userlevel 4

In the HTTPCaller, look under "HTTP Client options" and enable the option to save cookies:

 

In the HTTPCaller, look under "HTTP Client options" and enable the option to save cookies:

 

Thanks for your quick response, that did the trick!

Reply