最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - Mstrio-py can't establish connection due to Invalid URL - Stack Overflow

programmeradmin5浏览0评论

CODE:

import json
from mstrio.connection import Connection

base_url = "https://myURL/MSTAWS/MicroStrategyAPI/api/"
mstr_username = "myusername"
mstr_password = "mypassword"
project_name = "myproject"
conn = Connection(base_url, mstr_username, mstr_password, project_name=project_name)

Error code :  raise InvalidURL(f"Invalid URL {url!r}: No host supplied")
requests.exceptions.InvalidURL: Invalid URL 'https:/api/auth/login': No host supplied

From my research it looks like the base URL is not getting passed to the prepare_URL function

code block from "requests" library "models.py" file

def prepare_url(self, url, params):
        """Prepares the given HTTP URL."""
        #: Accept objects that have string representations.
        #: We're unable to blindly call unicode/str functions
        #: as this will include the bytestring indicator (b'')
        #: on python 3.x.
        #: 
        if isinstance(url, bytes):
            url = url.decode("utf8")
        else:
            url = str(url)

        # Remove leading whitespaces from url
        url = url.lstrip()

        # Don't do any URL preparation for non-HTTP schemes like `mailto`,
        # `data` etc to work around exceptions from `url_parse`, which
        # handles RFC 3986 only.
        if ":" in url and not url.lower().startswith("http"):
            self.url = url
            return

        # Support for unicode domain names and paths.
        try:
            scheme, auth, host, port, path, query, fragment = parse_url(url)
        except LocationParseError as e:
            raise InvalidURL(*e.args)

        if not scheme:
            raise MissingSchema(
                f"Invalid URL {url!r}: No scheme supplied. "
                f"Perhaps you meant https://{url}?"
            )

        if not host:
            raise InvalidURL(f"Invalid URL {url!r}: No host supplied")

would someone be able to help me find out why the url is not getting passed when i set it as a parameter withen the connection class?

I tried re-adding mstrio-py dependencies to see if that would fix it.

发布评论

评论列表(0)

  1. 暂无评论