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

**URL:** <https://forums.digi.com/t/how-to-retreive-multiple-files-folders-using-httplib-http-method/3211>\
**Category:** Device Manager\
**Created:** [January 28, 2013, 9:47pm UTC](https://forums.digi.com/t/how-to-retreive-multiple-files-folders-using-httplib-http-method/3211 "2013-01-28T21:47:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hli\_skyclimber](https://avatars.discourse-cdn.com/v4/letter/h/5f8ce5/32.png) [@hli\_skyclimber](https://forums.digi.com/u/hli_skyclimber)\
**Post date:** [January 28, 2013, 9:47pm UTC](https://forums.digi.com/t/how-to-retreive-multiple-files-folders-using-httplib-http-method/3211/1 "2013-01-28T21:47:50Z")

</div>

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](http://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](http://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
