matbarofex / pyRofex

Python library to connect with Matba Rofex's Rest and Websocket APIs. Market Data and Order Routing are supported.
MIT License
83 stars 56 forks source link

KeyError: 'x-auth-token' #5

Closed amazzuca closed 4 years ago

amazzuca commented 4 years ago

Describe the bug Cuando inicializo una instancia de pyRofex me devuelve el siguiente error :

C:\Users\Ale10\Anaconda3\envs\IB-tws\lib\site-packages\urllib3\connectionpool.py:1004: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning, C:\Users\Ale10\Anaconda3\envs\IB-tws\lib\site-packages\urllib3\connectionpool.py:1004: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings InsecureRequestWarning,

KeyError Traceback (most recent call last)

in 3 password=passw, 4 account=account, ----> 5 environment=pyRofex.Environment.REMARKET) ~\Anaconda3\envs\IB-tws\lib\site-packages\pyRofex\service.py in initialize(user, password, account, environment) 38 :type proxies: dict 39 """ ---> 40 _validate_environment(environment) 41 _set_environment_parameters(user, password, account, environment, proxies) 42 globals.environment_config[environment]["rest_client"] = RestClient(environment) ~\Anaconda3\envs\IB-tws\lib\site-packages\pyRofex\clients\rest_rfx.py in __init__(self, environment) 32 33 # Get the authentication Token. ---> 34 self.update_token() 35 36 def get_trade_history(self, ticker, start_date, end_date, market): ~\Anaconda3\envs\IB-tws\lib\site-packages\pyRofex\clients\rest_rfx.py in update_token(self) 268 269 if not response.ok: --> 270 raise ApiException("Authentication fails. Incorrect User or Password") 271 272 self.environment["token"] = response.headers['X-Auth-Token'] ~\Anaconda3\envs\IB-tws\lib\site-packages\requests\structures.py in __getitem__(self, key) 50 51 def __getitem__(self, key): ---> 52 return self._store[key.lower()][1] 53 54 def __delitem__(self, key): KeyError: 'x-auth-token'
fzanuso commented 4 years ago

Hola Alejandro, que versión de la librearía estas utilizando? En la versión 0.3.0, se soluciono un cambio que hicieron con la API de Remarket para conexiones HTTPS.

Todo parece indicar que ejecutando el siguiente comando se soluciona: pip install -U pyRofex

Avisame cualquier cosa.

amazzuca commented 4 years ago

Gracias por la info, tema resuelto.