searches 1.1 KB

1234567891011121314151617181920212223242526
  1. #!/usr/bin/env python2
  2. # You may redistribute this program and/or modify it under the terms of
  3. # the GNU General Public License as published by the Free Software Foundation,
  4. # either version 3 of the License, or (at your option) any later version.
  5. #
  6. # This program is distributed in the hope that it will be useful,
  7. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. # GNU General Public License for more details.
  10. #
  11. # You should have received a copy of the GNU General Public License
  12. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. from cjdnsadmin.cjdnsadmin import connectWithAdminInfo;
  14. cjdns = connectWithAdminInfo();
  15. i = 0;
  16. while (True):
  17. search = cjdns.SearchRunner_showActiveSearch(i);
  18. if ('target' not in search):
  19. if i != 0: print;
  20. break;
  21. print(str(i) + ' tar: ' + search['target'] + ' last asked: ' + search['lastNodeAsked'] +
  22. ' asked: ' + str(search['totalRequests']) + ' count: ' + str(search['activeSearches']));
  23. i = i + 1;