Question

Multiple url via the HTTPFetcher


Userlevel 4
Badge +13
Hi,

 

 

Was wondering if anybody managed to use the HTTPFetcher (saving the files) with multiple url's.

 

 

Any suggestions are welcome.

 

Itay

10 replies

Userlevel 2
Badge +17
Hi Itay, long time!

 

 

Both target URL and output filename can be specified as Attribute Value, so I would try to send multiple features having pair of URL and  filename to the HTTPFeatcher as initiators.

 

 

Takashi
Userlevel 4
Badge +13
Hi Takashi,

 

Yes, been busy :)

 

I actually didnt think about using the Target attribute but the file name (that cannot be set by an attribute or parameter), thanks for the redirection.

 

Itay
Badge +3
Hi Itay!

 

 

I do that, like Takashi said, by parsing the target url using attributes:

 

 

for example :

 

http://geodata.nationaalgeoregister.nl/ahn2/extract/ahn2_05m_ruw/@Value(Blad).tif.zip

 

 

This one is used to dinamically fetch rasters.

 

In this case i fetch the downloadpage.xml in  a separate fetcher and extract the url, using the ahngridfile i build the url using another fetcher.

 

 

U could do @Value(url)@Value(Blad).@Value(extension) or something like it.
Userlevel 4
Badge +13
Hi Gio!,

 

 

Was nice meeting you in person at the fmewt, thanks for the answer, I got it working as suggested by Takashi.

 

 

Userlevel 4
Badge +13
Now the next step, can I specify a download location directly in the httpfetcher?
Userlevel 2
Badge +17
Setting like this?

 

 

Badge +3
Almost all fields have a pulldownmenu (arrow) on the rightside of the parameterpanel. Trough these u can acces attributes, parameters, stringeditor, conditionals etc. (no arithmetic...but you can circumvent that mostly)

 

 

donwloadlocation from my previous post:

 

G:\\LDNKDG\\KDGGE\\CGI\\Projecten\\2014\\G14-051_Rhijnhofweg_hoogtemetingen_in_digitale_kaart\\Analyse\\@Value(Blad).tif.zip
Userlevel 4
Badge +13
Thanks guys, but I should have been more specific about what I want to acomplish.

 

Basically when no output filename is spcecified, the file downloaded will be located at the same location as the workspace is.

 

I wanted a small variation on that, basically downloading to a sub folder of the FME_MF_DIR parameter.

 

By adding $(FME_MF_DIR)\\Download\\@Value(Id) I basically got that, now that made me wonder if FME will create the sub folder if it does not exist, unfortunatly that is not possible by only using the HTTPFetcher.

 

But then I can live with that too,

 

Cheers,

 

Itay
Userlevel 2
Badge +17
New folder can be created with a simple script. For example:

 

-----

 

# PythonCaller script example

 

import fmeobjects, os

 

def createFolder(feature):

 

    path = feature.getAttribute('_folderpath')

 

    if not os.path.exists(path):

 

        os.makedirs(path)

 

-----
Userlevel 4
Badge +13
Thanks Takashi.

Reply