nacos-group / nacos-group/nacos-sdk-python

不支持域名形式访问

Open
#34 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
471
Forks
155
PR merge metrics
No merged PRs in 30d

Description

问题如下:
通过域名的形式在浏览器中访问正常,切可以通过client.py中的_do_sync_req函数拿到正确的url拼接参数,但是在_do_sync_req函数中有一个奇怪的操作server_info = self.get_server() if not server_info: logger.error("[do-sync-req] can not get one server.") raise NacosRequestException("Server is not available.") address, port = server_info server = ":".join([address, str(port)]) server_url = "%s://%s" % ("http", server) if python_version_bellow("3"): req = Request(url=server_url + url, data=urlencode(data).encode() if data else None, headers=all_headers) req.get_method = lambda: method else: req = Request(url=server_url + url, data=urlencode(data).encode() if data else None, headers=all_headers, method=method)
直接吧port加到了路由中然后去访问,这样对于通过域名方式访问就是把url拼接为 xxx.com:port ,这样会造成requests请求失败超时。希望可以兼容域名方式访问nacos。谢谢

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in client.py at _do_sync_req and trace get_server, then reproduce a request using a domain-based Nacos address. Compare the constructed request URL with the browser-working URL and verify that domain access completes without a requests timeout.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.