'API Request error: ConnectionResetError: [WinError 10054] - An existing connection was forced to be cancelled by the remote host

I'm trying to get some data from the WITS API using phyton, but every time that I run my code an error.

ConnectionResetError: [WinError 10054] - An existing connection was forced to be cancelled by the remote host. Any idea how I can fix it? My code:

import requests as rqst
import pandas as pd
from flask_sqlalchemy import SQLAlchemy
import json

api = rqst.get('http://wits.worldbank.org/API/V1/SDMX/V21/datasource/TRN/reporter/840/partner/076/product/010121/year/2018/datatype/reported?format=JSON')

req = api.json()
raw_data = []
raw_data.append(req)

dataset = pd.DataFrame(raw_data, columns=['Reporter', 'Year','Partner','Product', 'MFN Tariff','Applied Tariff', 'Total Tariff Lines', 'Is Traded'])

print(dataset) 


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source