libsodium: Migrate from libnacl to PyNaCl
I am willing to retrieve Cesium+ member data
- Installed duniterpy with:
pip3 install duniterpy
OK - Made my script from example: nano request_cesium_profile.py
import asyncio
from duniterpy.api.client import Client
ES_CORE_ENDPOINT = "ES_CORE_API g1.data.duniter.fr 443"
ES_USER_ENDPOINT = "ES_USER_API g1.data.duniter.fr 443"
async def main():
"""
Main code (synchronous requests)
"""
# Create Client from endpoint string in Duniter format
client = Client(ES_USER_ENDPOINT)
# prompt entry
# pubkey = input("\nEnter a public key to get the user profile: ")
pubkey = "DsEx1pS33vzYZg4MroyBV9hCw98j1gtHEhwiZ5tK7ech"
# Get the profil of a public key (direct REST GET request)
# print("\nGET user/profile/{0}/_source:".format(pubkey))
response = await client.get('user/profile/{0}/_source'.format(pubkey.strip(' \n')))
print(response)
# Close client aiohttp session
await client.close()
# Latest duniter-python-api is asynchronous and you have to use asyncio, an asyncio loop and a "as" on the data.
# ( https://docs.python.org/3/library/asyncio.html )
asyncio.get_event_loop().run_until_complete(main())
python3 request_cesium_profile.py
Traceback (most recent call last):
File "request_cesium_profile.py", line 2, in <module>
from duniterpy.api.client import Client
File "/usr/local/lib/python3.5/dist-packages/duniterpy/__init__.py", line 24, in <module>
from . import api, documents, key
File "/usr/local/lib/python3.5/dist-packages/duniterpy/documents/__init__.py", line 10, in <module>
from .crc_pubkey import CRCPubkey
File "/usr/local/lib/python3.5/dist-packages/duniterpy/documents/crc_pubkey.py", line 7, in <module>
from ..helpers import ensure_str
File "/usr/local/lib/python3.5/dist-packages/duniterpy/helpers.py", line 2, in <module>
from libnacl.encode import hex_decode, hex_encode
File "/usr/local/lib/python3.5/dist-packages/libnacl/__init__.py", line 83, in <module>
nacl = _get_nacl()
File "/usr/local/lib/python3.5/dist-packages/libnacl/__init__.py", line 81, in _get_nacl
raise OSError(msg)
OSError: Could not locate nacl lib, searched for libsodium.so, libsodium.so.23, libsodium.so.18, libsodium.so.17, libsodium.so.13, libsodium.so.10, libsodium.so.5, libsodium.so.4,
What is wrong?
Edited by Moul