How to retreive multiple files/folders using httplib.HTTP method?

Hi,

I tried to retrieve all the files and read the contents of all the files under each of my device folders under my iDigi account. Under each device folder, there are multiple folders, and under each of these folders, there are files.

The folder structure is like this:
my.idigi.com/ws/FileData/~/Device_ID/folder1/file1.xml
/file2.xml
/folder2/file3.xml
/file4.xml

I was not able to find a good way to do so.

I was able to read only the information of the Device_ID folder when I used the following Python scripts. Can anyone help on this? Thanks.


----------Python Scripts Below----------------------------------------------

USERNAME = Config.USERNAME
PASSWORD = Config.PASSWORD
IDIGI_URL = “my.idigi.com
auth = base64.encodestring(“%s:%s”%(USERNAME,PASSWORD))[:-1]

webservice = httplib.HTTP(IDIGI_URL,80)
webservice.putrequest(‘GET’, ‘/ws/FileData/~/%s’%Device_ID)
webservice.putheader(“Authorization”, “Basic %s”%auth)
webservice.putheader(“Content-type”, “text/xml; charset="UTF-8"”)
webservice.endheaders()

get the reply to the request

returncode, returnmsg, headers = webservice.getreply()

if successful, print out the contents of the XML file

if returncode == 200:
xml = webservice.getfile()
xml_data = xml.read()
print xml_data

Have you seen these links:
http://www.digi.com/wiki/developer/index.php/IDigi_Data

http://www.digi.com/wiki/developer/index.php/Archiving_Data_Files_from_iDigi

They might be helpful in your case.

And these examples might also help you:

This is how you get list of all your deviceIDs:
https://my.idigi.com/ws/DeviceCore

This is how you get list of your folders and files for one deviceID:
https://my.idigi.com/ws/data/~/?_recursive=yes

This is how you download one file:
https://my.idigi.com/ws/data/~///

Juha