{"action":"created","issue":{"url":"https://api.github.com/repos/arvidn/libtorrent/issues/602","repository_url":"https://api.github.com/repos/arvidn/libtorrent","labels_url":"https://api.github.com/repos/arvidn/libtorrent/issues/602/labels{/name}","comments_url":"https://api.github.com/repos/arvidn/libtorrent/issues/602/comments","events_url":"https://api.github.com/repos/arvidn/libtorrent/issues/602/events","html_url":"https://github.com/arvidn/libtorrent/issues/602","id":146997266,"number":602,"title":"question : dht_get_peers python binding?","user":{"login":"ardhipoetra","id":2739025,"avatar_url":"https://avatars.githubusercontent.com/u/2739025?v=3","gravatar_id":"","url":"https://api.github.com/users/ardhipoetra","html_url":"https://github.com/ardhipoetra","followers_url":"https://api.github.com/users/ardhipoetra/followers","following_url":"https://api.github.com/users/ardhipoetra/following{/other_user}","gists_url":"https://api.github.com/users/ardhipoetra/gists{/gist_id}","starred_url":"https://api.github.com/users/ardhipoetra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ardhipoetra/subscriptions","organizations_url":"https://api.github.com/users/ardhipoetra/orgs","repos_url":"https://api.github.com/users/ardhipoetra/repos","events_url":"https://api.github.com/users/ardhipoetra/events{/privacy}","received_events_url":"https://api.github.com/users/ardhipoetra/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-04-08T18:06:08Z","updated_at":"2016-04-11T09:43:22Z","closed_at":null,"body":"Is there any way to do `get_peers` query explicitly in python binding? I saw `dht_get_peers` definition in `bindings/python/src/session.cpp` that (maybe) call `dht_get_peers` in `session_impl`.\r\n\r\nIs this function can be called from session object? how to expose it so I can call it (from where doesn't matter). To be honest I can't understand how the binding works. The way it's defined is the same as `is_dht_running` (picked up as example), but it just won't work.\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/arvidn/libtorrent/issues/comments/208257824","html_url":"https://github.com/arvidn/libtorrent/issues/602#issuecomment-208257824","issue_url":"https://api.github.com/repos/arvidn/libtorrent/issues/602","id":208257824,"user":{"login":"ardhipoetra","id":2739025,"avatar_url":"https://avatars.githubusercontent.com/u/2739025?v=3","gravatar_id":"","url":"https://api.github.com/users/ardhipoetra","html_url":"https://github.com/ardhipoetra","followers_url":"https://api.github.com/users/ardhipoetra/followers","following_url":"https://api.github.com/users/ardhipoetra/following{/other_user}","gists_url":"https://api.github.com/users/ardhipoetra/gists{/gist_id}","starred_url":"https://api.github.com/users/ardhipoetra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ardhipoetra/subscriptions","organizations_url":"https://api.github.com/users/ardhipoetra/orgs","repos_url":"https://api.github.com/users/ardhipoetra/repos","events_url":"https://api.github.com/users/ardhipoetra/events{/privacy}","received_events_url":"https://api.github.com/users/ardhipoetra/received_events","type":"User","site_admin":false},"created_at":"2016-04-11T09:43:22Z","updated_at":"2016-04-11T09:43:22Z","body":"That's weird, I can't get any `alerts` you mentioned. Full code in (here)[https://gist.github.com/ardhipoetra/e9ab3a94cf576c0208fcdca97560619b], but my step is : \r\n\r\n```\r\nimport libtorrent as lt\r\nimport time\r\n\r\ninfohash_str = \"5aec5ee9f2d044316fe1de29d221452103ceb958\"\r\nses = lt.session()\r\nses.start_dht()\r\nses.add_dht_router('router.bittorrent.com', 6881)\r\nses.add_dht_router('router.utorrent.com', 6881)\r\nses.add_dht_router('router.bitcomet.com', 6881)\r\n\r\nihash_sh1 = lt.sha1_hash(infohash_str)\r\n\r\nses.dht_get_peers(ihash_sh1)\r\n\r\nstopped = False\r\ncount = 0\r\nwhile(not stopped):\r\n    al = ses.pop_alerts()\r\n\r\n    if not len(al):\r\n        time.sleep(5)\r\n\r\n        # furiously ask for peers!\r\n        ses.dht_get_peers(ihash_sh1)\r\n    else:\r\n        for a in al:\r\n            print a\r\n            count += 1\r\n\r\n        time.sleep(1)\r\n\r\n    # we've seen enough\r\n    if count >= 30:\r\n        stopped = True\r\n```\r\n\r\nWhat do you think?"}}