hootnot / oandapyV20-examples

Examples demonstrating the use of oandapyV20 (oanda-api-v20)
MIT License
147 stars 65 forks source link

DH_KEY_TOO_SMALL #27

Closed thomasschindler closed 4 years ago

thomasschindler commented 4 years ago

I have set up a docker image with this Dockerfile:

FROM debian:latest
apt-get update
yes | apt-get upgrade
yes | apt-get install python
yes | apt-get install curl
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
pip install oandapyV20
yes | apt-get install git
git clone https://github.com/hootnot/oandapyV20-examples
cd oandapyV20-examples/
pip install urwid
pip install -r requirements.txt
CMD tail -f /dev/null

It sets everything up nicely - but when i run root@ed209233d1bb:/oandapyV20-examples# python src/instruments_list.py

i get:

Traceback (most recent call last):
  File "src/instruments_list.py", line 13, in <module>
    rv = client.request(r)
  File "/usr/local/lib/python2.7/dist-packages/oandapyV20/oandapyV20.py", line 306, in request
    request_args, headers=headers)
  File "/usr/local/lib/python2.7/dist-packages/oandapyV20/oandapyV20.py", line 234, in __request
    raise err
requests.exceptions.SSLError: HTTPSConnectionPool(host='api-fxpractice.oanda.com', port=443): Max retries exceeded with url: /v3/accounts/thomasschindler/instruments (Caused by SSLError(SSLError(1, u'[SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c:727)'),))

All i can find on this is that the server must be operating on an outdated TLS version. Do you have any experience with that?

hootnot commented 4 years ago

Hi,

I have not encountered this error before.

I don't find any setup of the token and accountID in your Dockerfile.

You need these.

The URL shows: /v3/accounts/thomasschindler/instruments that means you use thomasschindler as account ID. That is not going to work.

The you need a V20-account number and the token. Check the README in the repo for details.

When you are sure that you have a correct token and account, you always can use curl to check if things are OK, see examples: http://developer.oanda.com/rest-live-v20/account-ep/

One advise: start using Python3. Support for Python 2.7 will be dropped in january 2020

thomasschindler commented 4 years ago

Thank you for your answer! I will use the accountID - my bad!