diff --git a/duniterpy/api/client.py b/duniterpy/api/client.py index 9392975d48740ad294028f931a03f9cc97bf1e9d..9818f8466f8cabb87e5c217b3d5ab8beedf6273e 100644 --- a/duniterpy/api/client.py +++ b/duniterpy/api/client.py @@ -181,9 +181,9 @@ class API: """ def __init__( - self, - connection_handler: endpoint.ConnectionHandler, - headers: Optional[dict] = None, + self, + connection_handler: endpoint.ConnectionHandler, + headers: Optional[dict] = None, ) -> None: """ Asks a module in order to create the url used then by derivated classes. @@ -207,8 +207,11 @@ class API: server, port = self.connection_handler.server, self.connection_handler.port if self.connection_handler.path: - url = "{scheme}://{server}:{port}/{path}".format( - scheme=scheme, server=server, port=port, path=path + url = "{scheme}://{server}:{port}/{api_path}".format( + scheme=scheme, + server=server, + port=port, + api_path=self.connection_handler.path, ) else: url = "{scheme}://{server}:{port}/".format( @@ -299,10 +302,10 @@ class Client: """ def __init__( - self, - _endpoint: Union[str, endpoint.Endpoint], - session: ClientSession = None, - proxy: str = None, + self, + _endpoint: Union[str, endpoint.Endpoint], + session: ClientSession = None, + proxy: str = None, ) -> None: """ Init Client instance @@ -331,11 +334,11 @@ class Client: self.proxy = proxy async def get( - self, - url_path: str, - params: dict = None, - rtype: str = RESPONSE_JSON, - schema: dict = None, + self, + url_path: str, + params: dict = None, + rtype: str = RESPONSE_JSON, + schema: dict = None, ) -> Any: """ GET request on self.endpoint + url_path @@ -369,11 +372,11 @@ class Client: return result async def post( - self, - url_path: str, - params: dict = None, - rtype: str = RESPONSE_JSON, - schema: dict = None, + self, + url_path: str, + params: dict = None, + rtype: str = RESPONSE_JSON, + schema: dict = None, ) -> Any: """ POST request on self.endpoint + url_path diff --git a/examples/create_and_publish_identity.py b/examples/create_and_publish_identity.py index a451502f19c094e14c9e65ed34e37efbeb53d256..4b5ab771d1f1576e44a643aa2022a717a398ab3f 100644 --- a/examples/create_and_publish_identity.py +++ b/examples/create_and_publish_identity.py @@ -8,8 +8,8 @@ from duniterpy.key import SigningKey # CONFIG ####################################### -# You can either use a complete defined endpoint : [NAME_OF_THE_API] [DOMAIN] [IPv4] [IPv6] [PORT] -# or the simple definition : [NAME_OF_THE_API] [DOMAIN] [PORT] +# You can either use a complete defined endpoint : [NAME_OF_THE_API] [DOMAIN] [IPv4] [IPv6] [PORT] [PATH] +# or the simple definition : [NAME_OF_THE_API] [DOMAIN] [PORT] [PATH] # Here we use the secure BASIC_MERKLED_API (BMAS) BMAS_ENDPOINT = "BMAS g1-test.duniter.org 443" diff --git a/examples/request_data.py b/examples/request_data.py index 68b67366c589afa855399f3329772e2803073f2d..07abf02f73db7fa70919c143dd2922b7bc7edfc0 100644 --- a/examples/request_data.py +++ b/examples/request_data.py @@ -4,8 +4,8 @@ from duniterpy.api import bma # CONFIG ####################################### -# You can either use a complete defined endpoint : [NAME_OF_THE_API] [DOMAIN] [IPv4] [IPv6] [PORT] -# or the simple definition : [NAME_OF_THE_API] [DOMAIN] [PORT] +# You can either use a complete defined endpoint : [NAME_OF_THE_API] [DOMAIN] [IPv4] [IPv6] [PORT] [PATH] +# or the simple definition : [NAME_OF_THE_API] [DOMAIN] [PORT] [PATH] # Here we use the secure BASIC_MERKLED_API (BMAS) BMAS_ENDPOINT = "BMAS g1-test.duniter.org 443" diff --git a/examples/request_data_async.py b/examples/request_data_async.py index 77ad4992d123964bf9580abb2a66508c9aa06667..7e1f1ba90e8d2f44367d9baa0bc301ff57545c79 100644 --- a/examples/request_data_async.py +++ b/examples/request_data_async.py @@ -5,8 +5,8 @@ from duniterpy.api.client import Client # CONFIG ####################################### -# You can either use a complete defined endpoint : [NAME_OF_THE_API] [DOMAIN] [IPv4] [IPv6] [PORT] -# or the simple definition : [NAME_OF_THE_API] [DOMAIN] [PORT] +# You can either use a complete defined endpoint : [NAME_OF_THE_API] [DOMAIN] [IPv4] [IPv6] [PORT] [PATH] +# or the simple definition : [NAME_OF_THE_API] [DOMAIN] [PORT] [PATH] # Here we use the secure BASIC_MERKLED_API (BMAS) BMAS_ENDPOINT = "BMAS g1-test.duniter.org 443" diff --git a/examples/request_data_elasticsearch.py b/examples/request_data_elasticsearch.py index f389eadb8a0a00d7771c65e708382cada4a7d9f3..89bcd9ac3f6512f95893c4bc1d62be285f42b262 100644 --- a/examples/request_data_elasticsearch.py +++ b/examples/request_data_elasticsearch.py @@ -7,8 +7,8 @@ from duniterpy.api.client import Client # CONFIG ####################################### -# You can either use a complete defined endpoint : [NAME_OF_THE_API] [DOMAIN] [IPv4] [IPv6] [PORT] -# or the simple definition : [NAME_OF_THE_API] [DOMAIN] [PORT] +# You can either use a complete defined endpoint : [NAME_OF_THE_API] [DOMAIN] [IPv4] [IPv6] [PORT] [PATH] +# or the simple definition : [NAME_OF_THE_API] [DOMAIN] [PORT] [PATH] # Here we use the secure BASIC_MERKLED_API (BMAS) ES_CORE_ENDPOINT = "ES_CORE_API g1-test.data.duniter.fr 443" ES_USER_ENDPOINT = "ES_USER_API g1-test.data.duniter.fr 443" diff --git a/examples/request_web_socket_block.py b/examples/request_web_socket_block.py index 4a05dac1474f65b833db7f6b3c7bf18d2919840d..696c5be3eafd082f6d7a8003f5669c90110874ae 100644 --- a/examples/request_web_socket_block.py +++ b/examples/request_web_socket_block.py @@ -10,8 +10,8 @@ from duniterpy.api.client import Client # CONFIG ####################################### -# You can either use a complete defined endpoint : [NAME_OF_THE_API] [DOMAIN] [IPv4] [IPv6] [PORT] -# or the simple definition : [NAME_OF_THE_API] [DOMAIN] [PORT] +# You can either use a complete defined endpoint : [NAME_OF_THE_API] [DOMAIN] [IPv4] [IPv6] [PORT] [PATH] +# or the simple definition : [NAME_OF_THE_API] [DOMAIN] [PORT] [PATH] # Here we use the secure BASIC_MERKLED_API (BMAS) BMAS_ENDPOINT = "BMAS g1-test.duniter.org 443" diff --git a/examples/request_ws2p.py b/examples/request_ws2p.py index 6b8b7813d04277a1cf6b847fe17e9b76a3b7902a..2001acb442a810e1a4134ad95c042c5b0f1af18b 100644 --- a/examples/request_ws2p.py +++ b/examples/request_ws2p.py @@ -17,9 +17,9 @@ from duniterpy.api.client import Client # CONFIG ####################################### -# You can either use a complete defined endpoint : [NAME_OF_THE_API] [DOMAIN] [IPv4] [IPv6] [PORT] -# or the simple definition : [NAME_OF_THE_API] [DOMAIN] [PORT] -# Here we use the WS2P API (WS2P [UUID] [DOMAIN] [PORT]) +# You can either use a complete defined endpoint : [NAME_OF_THE_API] [DOMAIN] [IPv4] [IPv6] [PORT] [PATH] +# or the simple definition : [NAME_OF_THE_API] [DOMAIN] [PORT] [PATH] +# Here we use the WS2P API (WS2P [UUID] [DOMAIN] [PORT] [PATH]) # You can find the UUID of a node with the /network/ws2p/heads BMA API request # or in your node user interface in the network view in the WS2PID column WS2P_ENDPOINT = "WS2P 96675302 g1-test.duniter.org 443" diff --git a/examples/save_revoke_document.py b/examples/save_revoke_document.py index ffac355d5d84e269539e49113fbe29cce13ad5a9..4f4241cd9741a28b456cd066c4a1cbefce019eb9 100644 --- a/examples/save_revoke_document.py +++ b/examples/save_revoke_document.py @@ -20,8 +20,8 @@ else: # CONFIG ####################################### -# You can either use a complete defined endpoint : [NAME_OF_THE_API] [DOMAIN] [IPv4] [IPv6] [PORT] -# or the simple definition : [NAME_OF_THE_API] [DOMAIN] [PORT] +# You can either use a complete defined endpoint : [NAME_OF_THE_API] [DOMAIN] [IPv4] [IPv6] [PORT] [PATH] +# or the simple definition : [NAME_OF_THE_API] [DOMAIN] [PORT] [PATH] # Here we use the secure BASIC_MERKLED_API (BMAS) BMAS_ENDPOINT = "BMAS g1-test.duniter.org 443" diff --git a/examples/send_certification.py b/examples/send_certification.py index 1b103c47d7e4146c34b400dfee83c2aec3a71c95..6f4eda41265141e7ab96e3a3130feceedf3fd144 100644 --- a/examples/send_certification.py +++ b/examples/send_certification.py @@ -10,8 +10,8 @@ from duniterpy.key import SigningKey # CONFIG ####################################### -# You can either use a complete defined endpoint : [NAME_OF_THE_API] [DOMAIN] [IPv4] [IPv6] [PORT] -# or the simple definition : [NAME_OF_THE_API] [DOMAIN] [PORT] +# You can either use a complete defined endpoint : [NAME_OF_THE_API] [DOMAIN] [IPv4] [IPv6] [PORT] [PATH] +# or the simple definition : [NAME_OF_THE_API] [DOMAIN] [PORT] [PATH] # Here we use the secure BASIC_MERKLED_API (BMAS) BMAS_ENDPOINT = "BMAS g1-test.duniter.org 443" diff --git a/examples/send_membership.py b/examples/send_membership.py index f259213dcc39f8711f70c3281d10f217f812702b..1035c4ceaeb9aec24ad489e9337619eb31808aca 100644 --- a/examples/send_membership.py +++ b/examples/send_membership.py @@ -8,8 +8,8 @@ from duniterpy.key import SigningKey # CONFIG ####################################### -# You can either use a complete defined endpoint : [NAME_OF_THE_API] [DOMAIN] [IPv4] [IPv6] [PORT] -# or the simple definition : [NAME_OF_THE_API] [DOMAIN] [PORT] +# You can either use a complete defined endpoint : [NAME_OF_THE_API] [DOMAIN] [IPv4] [IPv6] [PORT] [PATH] +# or the simple definition : [NAME_OF_THE_API] [DOMAIN] [PORT] [PATH] # Here we use the secure BASIC_MERKLED_API (BMAS) BMAS_ENDPOINT = "BMAS g1-test.duniter.org 443" diff --git a/examples/send_transaction.py b/examples/send_transaction.py index fc34e869cd55a5604e527182e2881df8b3b638c5..333abb64ffda3cc786737ae936547df18dffca20 100644 --- a/examples/send_transaction.py +++ b/examples/send_transaction.py @@ -15,8 +15,8 @@ from duniterpy.key import SigningKey # CONFIG ####################################### -# You can either use a complete defined endpoint : [NAME_OF_THE_API] [DOMAIN] [IPv4] [IPv6] [PORT] -# or the simple definition : [NAME_OF_THE_API] [DOMAIN] [PORT] +# You can either use a complete defined endpoint : [NAME_OF_THE_API] [DOMAIN] [IPv4] [IPv6] [PORT] [PATH] +# or the simple definition : [NAME_OF_THE_API] [DOMAIN] [PORT] [PATH] # Here we use the secure BASIC_MERKLED_API (BMAS) BMAS_ENDPOINT = "BMAS g1-test.duniter.org 443"