MCPcopy
hub / github.com/HelloZeroNet/ZeroNet / siteDownload

Method siteDownload

src/main.py:288–314  ·  view source on GitHub ↗
(self, address)

Source from the content-addressed store, hash-verified

286 print(site.peers)
287
288 def siteDownload(self, address):
289 from Site.Site import Site
290 from Site import SiteManager
291 SiteManager.site_manager.load()
292
293 logging.info("Opening a simple connection server")
294 global file_server
295 from File import FileServer
296 file_server = FileServer("127.0.0.1", 1234)
297 file_server_thread = gevent.spawn(file_server.start, check_sites=False)
298
299 site = Site(address)
300
301 on_completed = gevent.event.AsyncResult()
302
303 def onComplete(evt):
304 evt.set(True)
305
306 site.onComplete.once(lambda: onComplete(on_completed))
307 print("Announcing...")
308 site.announce()
309
310 s = time.time()
311 print("Downloading...")
312 site.downloadContent("content.json", check_modifications=True)
313
314 print("Downloaded in %.3fs" % (time.time()-s))
315
316
317 def siteNeedFile(self, address, inner_path):

Callers

nothing calls this directly

Calls 6

announceMethod · 0.95
downloadContentMethod · 0.95
FileServerClass · 0.90
SiteClass · 0.90
onceMethod · 0.80
loadMethod · 0.45

Tested by

no test coverage detected