lastest changes

This commit is contained in:
2021-01-20 13:05:04 +04:00
parent a71905d698
commit 16fb7ca42f
20 changed files with 152 additions and 1 deletions

View File

@@ -0,0 +1,18 @@
'''
This scrypt uses curl to list servers in the IPFS network
'''
import requests
import json
def list_servers():
peers = requests.post('http://127.0.0.1:5001/api/v0/swarm/peers')
# TODO: Detect nodes that are servers
peers_dict = peers.json()
# Ping for each node
for i in peers_dict['Peers']:
ping = requests.post('http://127.0.0.1:5001/api/v0/ping?arg='+i['Peer']+'&count=1')
# Create a replace function TODO
print(str(ping.content)[2:-3])
list_servers()