Open tanga94 opened 3 years ago
pip install requests_cache
resolves the issue.
Hi @zhiboz, I installed the requests_cache
package and ran the following script (running it in R using the py_run_file
command in reticulate
)
from capiq.capiq_client import CapIQClient
ciq_client = CapIQClient("USERNAME", "PASSWORD")
return_value = ciq_client.gdsg(["TRIP"], ["IQ_CLOSEPRICE"], ["close_price"], properties=[{}])
but now its giving me the following error
Error in py_run_file_impl(file, local, convert) :
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Do you perhaps have access to Capital IQ and can recommend how to overcome this issue?
here is a working example:
ciq_client.gdshe(['WMT:', "ibm:"],['IQ_CLOSEPRICE'], ['close_price'], start_date='11/12/2010',end_date='11/18/2010')
@zhiboz how did you set your username and password universally before you ran that line of code? When i run the following, I still get the same error
from capiq.capiq_client import CapIQClient
ciq_client = CapIQClient("USERNAME", "PASSWORD")
ciq_client.gdshe(['WMT:', "ibm:"],['IQ_CLOSEPRICE'], ['close_price'], start_date='11/12/2010',end_date='11/18/2010')
@zhiboz anyway you could share your script to see how you managed to get this to run? You can obviously censor your username
and password
out?
Hi @tanga94, I haven't used reticulate so unfortunately can't really help there. Are you able to get the module running in Python?
Re: the original issue, can you confirm that you installed the packages in the requirements.txt file?
Hi @faaez , is this service still operational? I was informed that it isn't
@faaez I have installed all the packages in the requirements.txt file. When I try to this now in Python as opposed to reticulate
ciq_client.gdshe(['WMT:', "ibm:"],['IQ_CLOSEPRICE'], ['close_price'], start_date='11/12/2010',end_date='11/18/2010')
I get this error
send: b'POST /gdsapi/rest/v3/clientservice.json HTTP/1.1\r\nHost: api-ciq.marketintelligence.spglobal.com\r\nUser-Agent: python-requests/2.24.0\r\nAccept-Encoding: gzip,deflate\r\nAccept: */*\r\nConnection: keep-alive\r\nContent-Type: application/json\r\nContent-Length: 303\r\nAuthorization: Basic VGFuZ2VuaS5TaGF0aXdhQGJvbi5jb20ubmE6VGFuZ2VuaTEu\r\n\r\n'
send: b'{"inputRequests": [{"function": "GDSHE", "identifier": "WMT:", "mnemonic": "IQ_CLOSEPRICE", "properties": {"STARTDATE": "11/12/2010", "ENDDATE": "11/18/2010"}}, {"function": "GDSHE", "identifier": "ibm:", "mnemonic": "IQ_CLOSEPRICE", "properties": {"STARTDATE": "11/12/2010", "ENDDATE": "11/18/2010"}}]}'
reply: 'HTTP/1.1 401 Unauthorized\r\n'
header: Date: Sat, 16 Jan 2021 01:39:07 GMT
header: Content-Type: text/html; charset=iso-8859-1
header: Content-Length: 381
header: Connection: keep-alive
header: Server: Apache/2.4.29 (Unix) OpenSSL/1.0.2k-fips
header: WWW-Authenticate: Basic realm="LDAPs Login"
Traceback (most recent call last):
File "<ipython-input-35-1a1f7c6aeab8>", line 1, in <module>
ciq_client.gdshe(['WMT:', "ibm:"],['IQ_CLOSEPRICE'], ['close_price'], start_date='11/12/2010',end_date='11/18/2010')
File "C:\Users\user\anaconda3\lib\site-packages\capiq\capiq_client.py", line 84, in gdshe
return self.make_request(identifiers, mnemonics, return_keys, properties, "GDSHE", True)
File "C:\Users\user\anaconda3\lib\site-packages\capiq\capiq_client.py", line 157, in make_request
if len(response.json()['GDSSDKResponse']) == 1 and \
File "C:\Users\user\anaconda3\lib\site-packages\requests\models.py", line 898, in json
return complexjson.loads(self.text, **kwargs)
File "C:\Users\user\anaconda3\lib\json\__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "C:\Users\user\anaconda3\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\user\anaconda3\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
JSONDecodeError: Expecting value
Gotcha. Sorry I’m not able to help since I don’t have a CapIQ subscription anymore.
@zhiboz would you be able to help if this I working for you?
This is the returned header for this error:
This server could not verify that you
CapitalIQ has changed something with api access, the https requests string has changed, or something else. I may clone this on my github/ecjbosu. And try somethings.
Hi @faaez , I'm trying to use your package in R (through
reticulate
).I used the
py_install
function inreticulate
to install the package, which appears to have workedHowever, when I try to run the following lines (using my username and password of course).
I get the following error
Any idea what the issue could be?