python lib to get uk electricity prices code example

Example: python lib to get uk electricity prices

def load_data(report, date):    import requests    from io import StringIO    import pandas as pd    l1 = 'https://api.bmreports.com/BMRS/'    l2 = report    l3 = '/V1?APIKey=' + APIKEY + '&'    l7 = 'ServiceType=csv'    d = date.strftime('%Y-%m-%d')    if report in ['DERSYSDATA']:        l4 = "FromSettlementDate="+d+"&ToSettlementDate="+d+"&"    elif report in ['FORDAYDEM']:        l4 = "FromDate="+d+"&ToDate="+d+"&"    else:        l4 = ""    r = requests.get(l1+l2+l3+l4+l7 )    data = pd.read_csv(StringIO(r.text),                        header=None,                        skiprows=1)    data = data.iloc[:-1]    return data