Does any one knows how DownloadDb works? And the rest of the downloader’s family? And how it should work thanks!
DownloadDb doesn’t really have anything much interesting. But the rest of the downloader directory contains the HTTPClient code, which is pretty useful for doing basic HTTP access. It doesn’t give you anything that you wouldn’t already have with something like PyCurl, though.
David
Well i am really just looking for a way to download a file using the panda3d networking so that panda3d does not get blocked. I don’t want to do inter thread communication there and i am sure there is a way.
self.http = HTTPClient()
self.chan = self.http.makeChannel(1)
self.chan.beginGetDocument(DocumentSpec('http://my.url/'))
self.rf = Ramfile()
self.chan.downloadToRam(self.rf)
taskMgr.add(self.downloadTask, 'download')
def downloadTask(self, task):
if self.chan.run():
# Still waiting for file to finish downloading.
return task.cont
if not self.chan.isDownloadComplete():
print "Error downloading file."
return task.done
data = self.rf.getData()
print "got data:"
print data
return task.done
David
Thank you!