From 14caa317e02007b94dcd46accb87c08274114389 Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Fri, 3 Dec 2021 14:22:29 -0500 Subject: [PATCH] 2021-12-03 Fred Gleason * Modified the 'rivwebpyapi' so as to require only scheme and host parts of the URL provided to the 'url' parameter. Signed-off-by: Fred Gleason --- ChangeLog | 3 +++ apis/rivwebpyapi/api/rivwebpyapi.py | 13 +++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index d73c1acb..a3f9b5aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22612,3 +22612,6 @@ 2021-11-11 Fred Gleason * Removed debugging code from 'web/rdxport/carts.cpp'. * Removed debugging code from 'apis/rivwebpyapi/api/rivwebpyapi.py'. +2021-12-03 Fred Gleason + * Modified the 'rivwebpyapi' so as to require only scheme and host + parts of the URL provided to the 'url' parameter. diff --git a/apis/rivwebpyapi/api/rivwebpyapi.py b/apis/rivwebpyapi/api/rivwebpyapi.py index cc8c0ffe..1ea96409 100755 --- a/apis/rivwebpyapi/api/rivwebpyapi.py +++ b/apis/rivwebpyapi/api/rivwebpyapi.py @@ -23,6 +23,7 @@ import sys import datetime from datetime import timedelta import requests +from urllib.parse import urlparse from xml.sax.handler import ContentHandler import xml.sax @@ -186,14 +187,22 @@ class rivwebpyapi(object): Takes three arguments: url - The URL of the service. Typically of the form - 'http://rivendell.example.com/rd-bin/rdxport.cgi' (string). + 'http://rivendell.example.com' (string). username - The Rivendell Username to connect as (string). password - The password for the specified Rivendell Username (string). """ - self.__connection_url=url + # + # Normalize the URL + # + parsed_url=urlparse(url) + parsed_url=parsed_url._replace(path='/rd-bin/rdxport.cgi', + params='', + query='', + fragment='') + self.__connection_url=parsed_url.geturl() self.__connection_username=username self.__connection_password=password