Forums

api.cryptonator.com in Whitelist but doesn't work

I start this code from web application

STORE_SETTINGS = {
'merchant_id': 123d0j7aaaaaaaaaaaaaaaaaaaaaaaaa',
}

def startPayment(item_name = 'test', invoice_amount = 100, invoice_currency = 'usd', STORE_SETTINGS = STORE_SETTINGS):
    url = 'https://api.cryptonator.com/api/merchant/v1/startpayment'
    params = dict()
    params['merchant_id'] = STORE_SETTINGS['merchant_id']
    params['item_name'] = item_name
    params['invoice_amount'] = invoice_amount
    params['invoice_currency'] = invoice_currency
    r = requests.get(url, params = params)
    invoice_id = re.findall('[^\s/]*$', r.url)[0]
    return invoice_id, r.url


if __name__ == '__main__':
    print(startPayment(item_name = 'Med Card', invoice_amount = '100', invoice_currency = 'usd'))

Everything should go well cuz api.cryptonator.com in whitelist. But i get an err:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/requests/packages/urllib3/connectionpool.py", line 594, in urlopen
    self._prepare_proxy(conn)
  File "/usr/local/lib/python3.6/dist-packages/requests/packages/urllib3/connectionpool.py", line 810, in _prepare_proxy
    conn.connect()
  File "/usr/local/lib/python3.6/dist-packages/requests/packages/urllib3/connection.py", line 294, in connect
    self._tunnel()
  File "/usr/lib/python3.6/http/client.py", line 919, in _tunnel
    message.strip()))
OSError: Tunnel connection failed: 403 Forbidden
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/requests/adapters.py", line 423, in send
    timeout=timeout
  File "/usr/local/lib/python3.6/dist-packages/requests/packages/urllib3/connectionpool.py", line 649, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/local/lib/python3.6/dist-packages/requests/packages/urllib3/util/retry.py", line 376, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
requests.packages.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='www.cryptonator.com', port=443): Max retries exceeded with url: /merchant/invoice/7db23
412c75dc58d202706f2875f4a28 (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden',)))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "stalin.py", line 92, in <module>
    print(startPayment(item_name = 'Med Card', invoice_amount = '100', invoice_currency = 'usd'))
  File "stalin.py", line 86, in startPayment
    r = requests.get(url, params = params)
  File "/usr/local/lib/python3.6/dist-packages/requests/api.py", line 70, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/requests/api.py", line 56, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/requests/sessions.py", line 488, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.6/dist-packages/requests/sessions.py", line 630, in send
    history = [resp for resp in gen] if allow_redirects else []
  File "/usr/local/lib/python3.6/dist-packages/requests/sessions.py", line 630, in <listcomp>
    history = [resp for resp in gen] if allow_redirects else []
  File "/usr/local/lib/python3.6/dist-packages/requests/sessions.py", line 190, in resolve_redirects
    **adapter_kwargs
  File "/usr/local/lib/python3.6/dist-packages/requests/sessions.py", line 609, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/requests/adapters.py", line 485, in send
    raise ProxyError(e, request=request)
requests.exceptions.ProxyError: HTTPSConnectionPool(host='www.cryptonator.com', port=443): Max retries exceeded with url: /merchant/invoice/7db23412c75dc58d202706f28
75f4a28 (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden',)))

somehow your library is trying to connect to www.cryptonator.com which is not in the whitelist