首页 / 浏览问题 / 其他 / 问题详情
iclientpy不连接8090,改了端口也无法连
2EXP 2019年07月24日

使用产品:iserver 8c 810 操作系统:win7 x64
数据类型: oracle 11g x64 或 文件型
问题详细描述:iclientpy无法连接8090,改了端口也无法连接,

HTTPError: 403 Client Error: Forbidden for url: http://localhost:8090/iserver/services/security/login.json


问题重现步骤: 1.from iclientpy.server import Server
server = Server('http://localhost:8090/iserver','admin','supermap')
错误提示:

HTTPError                                 Traceback (most recent call last)
<ipython-input-2-e9d94284dc47> in <module>()
      1 from iclientpy.server import Server
----> 2 server = Server('http://localhost:8090/iserver','admin','supermap')

d:\Users\Administrator\Anaconda3\lib\site-packages\iclientpy\server.py in __init__(self, base_url, username, passwd, token, proxy, api_factory_clz)
     21         parms = (lambda ldict: {key: ldict[key] for key in ['base_url', 'username', 'passwd', 'token']})(locals())
     22         parms['proxies'] = None if proxy is None else dict.fromkeys(['http', 'https'], proxy)
---> 23         self._apifactory = api_factory_clz(**parms)
     24         self._services_page = self._apifactory.servicespage()
     25         servicelist = self._services_page.list_services()  # type: List[ServiceMetaInfo]

d:\Users\Administrator\Anaconda3\lib\site-packages\iclientpy\rest\apifactory.py in __init__(self, base_url, username, passwd, token, proxies)
    350         self._proxies = proxies if proxies is not None else _get_proxy_from_arguments()
    351         auth = create_auth(self._base_url + '/services/security/login.json', username, passwd, token,
--> 352                            proxies=self._proxies)
    353         self._handler = RestInvocationHandlerImpl(self._base_url, auth, proxies=self._proxies)
    354 

d:\Users\Administrator\Anaconda3\lib\site-packages\iclientpy\rest\apifactory.py in create_auth(login_url, username, passwd, token, proxies, check)
    304         # TODO session超时处理,定时刷新保证不超时,以及超时检测重新登录
    305         response = requests.post(login_url, json={'username': username, 'password': passwd}, proxies=proxies)
--> 306         response.raise_for_status()
    307         if check:
    308             check(response)

d:\Users\Administrator\Anaconda3\lib\site-packages\requests\models.py in raise_for_status(self)
    933 
    934         if http_error_msg:
--> 935             raise HTTPError(http_error_msg, response=self)
    936 
    937     def close(self):

HTTPError: 403 Client Error: Forbidden for url: http://localhost:8090/iserver/services/security/login.json

1个回答

iclientpy产品是9D才出的,所以请使用iServer 9D版本。另外连接iServer的用户名和参数确保正确。
1,520EXP 2019年07月24日
...