jmfernandes / robin_stocks

This is a library to use with Robinhood Financial App. It currently supports trading crypto-currencies, options, and stocks. In addition, it can be used to get real time ticker information, assess the performance of your portfolio, and can also get tax documents, total dividends paid, and more. More info at
http://www.robin-stocks.com
MIT License
1.72k stars 464 forks source link

403 Error attempting to access Crypto #269

Closed cheekylions closed 3 years ago

cheekylions commented 3 years ago

I've been trying to use get_crypto_quote() in PythonAnywhere and it's coming back with a 403 Forbidden error. Stocks work just fine. I was getting this yesterday, but I waited until today in case I was making too many tries to the site. I haven't run robin_stocks at all today except to test for this error message:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/CheekyLions/rh.py", line 50, in get_crypto_info
    ticker_info = rh.crypto.get_crypto_quote(ticker)
  File "/home/CheekyLions/.local/lib/python3.8/site-packages/robin_stocks/robinhood/helper.py", line 33, in login_wrapper
    return(func(*args, **kwargs))
  File "/home/CheekyLions/.local/lib/python3.8/site-packages/robin_stocks/robinhood/crypto.py", line 132, in get_crypto_quote
    id = get_crypto_info(symbol, info='id')
  File "/home/CheekyLions/.local/lib/python3.8/site-packages/robin_stocks/robinhood/crypto.py", line 102, in get_crypto_info
    data = request_get(url, 'results')
  File "/home/CheekyLions/.local/lib/python3.8/site-packages/robin_stocks/robinhood/helper.py", line 275, in request_get
  File "/home/CheekyLions/.local/lib/python3.8/site-packages/robin_stocks/robinhood/helper.py", line 275, in request_get
    res = SESSION.get(url, params=payload)
  File "/usr/lib/python3.8/site-packages/requests/sessions.py", line 546, in get
    return self.request('GET', url, **kwargs)
  File "/usr/lib/python3.8/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3.8/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3.8/site-packages/requests/adapters.py", line 510, in send
    raise ProxyError(e, request=request)
requests.exceptions.ProxyError: HTTPSConnectionPool(host='nummus.robinhood.com', port=443): Max retries exceeded with url: /currency_pairs/ (Caused
 by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden')))
cheekylions commented 3 years ago

Determined that PythonAnywhere was blocking 'nummus.robinhood.com' in their Whitelist.