Skip to content
Snippets Groups Projects
Commit 660470df authored by Vincent Texier's avatar Vincent Texier Committed by Vincent Texier
Browse files

[fix] #58 fix reverse_url path bug

parent 647bae19
No related branches found
No related tags found
2 merge requests!94Merge dev into master for release 0.56.0,!84#58: WS2P support
......@@ -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
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment