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

Doesn't work ok behind proxy server #3

Closed adriang1174 closed 4 years ago

adriang1174 commented 4 years ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. When working behind a proxy server (e.g. a company proxy) it throws an ApiException("Authentication fails. Incorrect User or Password")

  2. The call to request.post (or get) doesn't include proxies param in args

  3. The param "proxies" is included in request library but not used when called from rest_rfx.update_token and rest_rfx.api_request

Expected behavior A param for include proxy server configuration should be included. The following should work ok: proxies = {'http': 'server.company.com:80'}

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

fzanuso commented 4 years ago

Hi Adrian,

I created the branch _Issue-3/add_proxiessupport with the fix. Could you confirm me if that fix the proxie problem? I added a new parameter to set the proxie when you initialize the environment, so it will use this param when sending the request as you suggest.

Thanks!

adriang1174 commented 4 years ago

I've tested it. It Works OK. I just added the param to pyRofex.initialize call and that's it.

pyRofex.initialize(user=user, password=password, account=account, environment=pyRofex.Environment.REMARKET, proxies=proxies)

Nice and elegant solution! Thank you for your prompt response.

Are you going to close the issue? or merge the branch?

fzanuso commented 4 years ago

Excellent! Yes I merged it to master and close the issue.

Thanks for the feedback.