get_data() AttributeError: 'dict' object has no attribute 'url' using rdp

Answers
-
Thank you for reaching out to us.
The error is similar to the error on this discussion.
It may relate to the version of httpx installed on a Python environment. Therefore, please check the version of httpx.
C:\Users\U8009686>pip show httpx
WARNING: Ignoring invalid distribution ~lotly (C:\Python312\Lib\site-packages)
Name: httpx
Version: 0.26.0
Summary: The next generation HTTP client.
Home-page: https://github.com/encode/httpx
Author:
Author-email: Tom Christie <tom@tomchristie.com>
License:
Location: C:\Python312\Lib\site-packages
Requires: anyio, certifi, httpcore, idna, sniffio
Required-by: eikon, jupyterlab, lseg-data, refinitiv-data, refinitiv-dataplatform0 -
should we set up the proxy or what's I don't get any answer from the discussion that you attached
0 -
The client didn't share the resolution but I understand it should relate the proxy settings or dependency libraries.
You can check the version of httpx when the problem occurred on this page.
When you got the error, please run the following code on the same page.
import httpx print(httpx.__version__)
0 -
The version is 0.26.0
0 -
0
-
AttributeError: 'dict' object has no attribute 'url'File <command-4644964099624786>, line 4 1 response = rd.content.pricing.Definition( 2 ['EUR=', 'GBP=', 'JPY=', 'CAD='], 3 fields=['BID', 'ASK']----> 4 ).get_data()File /local_disk0/.ephemeral_nfs/envs/pythonEnv-7585eb21-5d87-405a-b12b-d8c07078895b/lib/python3.12/site-packages/refinitiv/data/content/_content_provider_layer.py:58, in ContentUsageLoggerMixin.get_data(self, session, on_response) 51 # Library usage logging 52 get_usage_logger().log_func( 53 name=f"{
ModuleName.CONTENT
}
.
{
self._USAGE_CLS_NAME
}
.get_data", 54 func_path=f"
{
self.__class__.__module__
}
.
{
self.__class__.__qualname__
}
.get_data", 55 kwargs={**self._kwargs}, 56 desc={FilterType.SYNC, FilterType.LAYER_CONTENT}, 57 )---> 58
return
super().get_data(session, on_response)File /local_disk0/.ephemeral_nfs/envs/pythonEnv-7585eb21-5d87-405a-b12b-d8c07078895b/lib/python3.12/site-packages/refinitiv/data/delivery/_data/_data_provider_layer.py:149, in DataProviderLayer.get_data(self, session, on_response) 133 """ 134 Sends a request to the client file store to retrieve the previously defined data. 135 (...) 146 147 """ 148 session = get_valid_session(session)--> 149 response = get_data(self._data_type, self._provider, session, **self._kwargs) 150
if
on_response
is
not
None
: 151 warnings.warn( 152 "Avoid using on_response for get_data method, it will be removed in future library version v2.0.", 153 category=
FutureWarning
, 154 )File /local_disk0/.ephemeral_nfs/envs/pythonEnv-7585eb21-5d87-405a-b12b-d8c07078895b/lib/python3.12/site-packages/refinitiv/data/delivery/_data/_data_provider_layer.py:51, in get_data(data_type, provider, session, **kwargs) 44 # Library usage logging 45 get_usage_logger().log_func( 46 name=f"
{
ModuleName.DELIVERY
}
.
{
DataProviderLayer._USAGE_CLS_NAME
}
.get_data", 47 func_path=f"
{
DataProviderLayer.__module__
}
.
{
DataProviderLayer.__qualname__
}
.get_data", 48 kwargs={"url": url, "auto_retry": auto_retry, **kwargs}, 49 desc={FilterType.SYNC, FilterType.LAYER_DELIVERY}, 50 )---> 51 response = provider.get_data(session, url, auto_retry=auto_retry, **kwargs) 52
return
responseFile /local_disk0/.ephemeral_nfs/envs/pythonEnv-7585eb21-5d87-405a-b12b-d8c07078895b/lib/python3.12/site-packages/refinitiv/data/delivery/_data/_data_provider.py:80, in DataProvider.get_data(self, session, *args, **kwargs) 78 raise_if_closed(session) 79 request = self.request.create(session, *args, **kwargs)---> 80 raw_response = self.connection.send(request, session, *args, **kwargs) 81
return
self._process_response(raw_response, request, session, *args, **kwargs)File /local_disk0/.ephemeral_nfs/envs/pythonEnv-7585eb21-5d87-405a-b12b-d8c07078895b/lib/python3.12/site-packages/refinitiv/data/delivery/_data/_connection.py:14, in HttpSessionConnection.send(self, request, session, auto_retry, *args, **kwargs) 11
def
send(self, request: Request, session: "Session", *args, auto_retry=
False
, **kwargs) -> "httpx.Response": 12 request.auto_retry = auto_retry---> 14
return
session.http_request(request)File /local_disk0/.ephemeral_nfs/envs/pythonEnv-7585eb21-5d87-405a-b12b-d8c07078895b/lib/python3.12/site-packages/refinitiv/data/_core/session/_platform_session.py:255, in PlatformSession.http_request(self, request) 254
def
http_request(self, request: "Request") -> "httpx.Response":--> 255
return
self._connection.http_request(request)File /local_disk0/.ephemeral_nfs/envs/pythonEnv-7585eb21-5d87-405a-b12b-d8c07078895b/lib/python3.12/site-packages/refinitiv/data/_core/session/connection.py:258, in RefinitivDataConnection.http_request(self, request) 257
def
http_request(self, request: "Request") -> httpx.Response:--> 258
return
self._session._http_service.request(request)File /local_disk0/.ephemeral_nfs/envs/pythonEnv-7585eb21-5d87-405a-b12b-d8c07078895b/lib/python3.12/site-packages/refinitiv/data/_core/session/http_service.py:333, in HTTPService.request(self, request) 331
def
request(self, request: "Request") -> httpx.Response: 332
if
self._client.is_closed():--> 333 self._client.open() 335
try
: 336 response = self._client.send(request)File /local_disk0/.ephemeral_nfs/envs/pythonEnv-7585eb21-5d87-405a-b12b-d8c07078895b/lib/python3.12/site-packages/refinitiv/data/_core/session/http_service.py:179, in HTTPClient.open(self) 175 proxies = self._session._proxies.get_proxy_for_httpx() 177 # httpx has its default Accept header and 178 # server wants application/json or nothing--> 179 self._client = get_httpx_client( 180 headers={"Accept": APPLICATION_JSON}, 181 limits=limits, 182 proxies=proxies, 183 ) 185 key = configure.keys.http_auto_retry_config 186 auto_retry_config = config.get(key,
None
)File /local_disk0/.ephemeral_nfs/envs/pythonEnv-7585eb21-5d87-405a-b12b-d8c07078895b/lib/python3.12/site-packages/refinitiv/data/_core/session/http_service.py:152, in get_httpx_client(proxies, **kwargs) 150
def
get_httpx_client(proxies, **kwargs): 151
if
httpx.__version__ >= "0.26.0":--> 152 client = httpx.Client(proxy=proxies, **kwargs) 153
else
: 154 client = httpx.Client(proxies=proxies, **kwargs)File /databricks/python/lib/python3.12/site-packages/httpx/_client.py:700, in Client.__init__(self, auth, params, headers, cookies, verify, cert, trust_env, http1, http2, proxy, mounts, timeout, follow_redirects, limits, max_redirects, event_hooks, base_url, transport, default_encoding) 686 proxy_map = self._get_proxy_map(proxy, allow_env_proxies) 688 self._transport = self._init_transport( 689 verify=verify, 690 cert=cert, (...) 695 transport=transport, 696 ) 697 self._mounts: dict[URLPattern, BaseTransport |
None
] = { 698 URLPattern(key):
None
699
if
proxy
is
None
--> 700
else
self._init_proxy_transport( 701 proxy, 702 verify=verify, 703 cert=cert, 704 trust_env=trust_env, 705 http1=http1, 706 http2=http2, 707 limits=limits, 708 ) 709
for
key, proxy
in
proxy_map.items() 710 } 711
if
mounts
is
not
None
: 712 self._mounts.update( 713 {URLPattern(key): transport
for
key, transport
in
mounts.items()} 714 )File /databricks/python/lib/python3.12/site-packages/httpx/_client.py:750, in Client._init_proxy_transport(self, proxy, verify, cert, trust_env, http1, http2, limits) 740
def
_init_proxy_transport( 741 self, 742 proxy: Proxy, (...) 748 limits: Limits = DEFAULT_LIMITS, 749 ) -> BaseTransport:--> 750
return
HTTPTransport( 751 verify=verify, 752 cert=cert, 753 trust_env=trust_env, 754 http1=http1, 755 http2=http2, 756 limits=limits, 757 proxy=proxy, 758 )File /databricks/python/lib/python3.12/site-packages/httpx/_transports/default.py:168, in HTTPTransport.__init__(self, verify, cert, trust_env, http1, http2, limits, proxy, uds, local_address, retries, socket_options) 155
if
proxy
is
None
: 156 self._pool = httpcore.ConnectionPool( 157 ssl_context=ssl_context, 158 max_connections=limits.max_connections, (...) 166 socket_options=socket_options, 167 )--> 168
elif
proxy.url.scheme
in
("http", "https"): 169 self._pool = httpcore.HTTPProxy( 170 proxy_url=httpcore.URL( 171 scheme=proxy.url.raw_scheme, (...) 185 socket_options=socket_options, 186 ) 187
elif
proxy.url.scheme
in
("socks5", "socks5h"):
Diagnose errorDebugAssistant Quick Fix: OFF Code Text Assistant0 -
Hello @dewi
Can you try with the latest https://pypi.org/project/lseg-data/ ) which is the Data Library version 2?
(The library interfaces are mostly the same as Refinitiv Data Library (Data Library version 1) except the get_data() method requires the fields parameter.
I strongly suggest you try with a new Python virtual environment (venv or conda).
0 -
I already use the lseg data but got the same issue
0 -
I assume that you are using the Databricks.
I tested it on Azure Databricks and it works fine.
You may try to downgrade the httpx to 0.24.1 and then restart the environment.
0 -
I already following you setup session and downgrade the httpx, also restart the kernel but I got this error messages
How to setup the session? Could you share the clearly documentation?0 -
[Error 400] - {'error': 'access_denied'}Session is not opened. Can't send any requestValueError: Session is not opened. Can't send any request
0 -
The issue may be specific to your environment.
Could you specify which Python environment or distribution you're currently using?
You may try to test it on another environment.
0 -
Did the error change?
0 -
the error change to this
[Error 400] - {'error': 'access_denied'}Session is not opened. Can't send any requestValueError: Session is not opened. Can't send any request
0 -
It typically means that the credentials (user name and password) are incorrect.
You can check your credentials by accessing this website (https://apidocs.refinitiv.com/Apps/ApiDocs).
How did you solve the first issue (AttributeError: 'dict' object has no attribute 'url')?
0 -
https://apidocs.refinitiv.com/Apps/ApiDocs
when I access this link I got an authentication denied0 -
I follow step by step, username and password is correct but I got access denied
0 -
If you are getting authentication denied when using API Playground, this means that your credentials are incorrect.
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 167 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 688 Datastream
- 1.4K DSS
- 624 Eikon COM
- 5.2K Eikon Data APIs
- 11 Electronic Trading
- 1 Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 255 ETA
- 557 WebSocket API
- 38 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 276 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 692 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 105 UPA
- 194 TREP Infrastructure
- 229 TRKD
- 918 TRTH
- 5 Velocity Analytics
- 10 Wealth Management Web Services
- 91 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 48 中文论坛