lastest changes
This commit is contained in:
BIN
client/python/__pycache__/ipfs_config.cpython-38.pyc
Normal file
BIN
client/python/__pycache__/ipfs_config.cpython-38.pyc
Normal file
Binary file not shown.
8
client/python/ipfs_config.py
Normal file
8
client/python/ipfs_config.py
Normal file
@@ -0,0 +1,8 @@
|
||||
'''
|
||||
This scrypt creates basic config for IPFS server
|
||||
'''
|
||||
import ipfsApi
|
||||
|
||||
def config():
|
||||
api = ipfsApi.Client('127.0.0.1', 5001)
|
||||
return api
|
||||
18
client/python/list-server.py
Normal file
18
client/python/list-server.py
Normal 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()
|
||||
Reference in New Issue
Block a user