Forum Discussion

BenLyon's avatar
BenLyon
Frequent Visitor
1 year ago
Solved

Get data from a API with a copy data

Hello    I need to get data from this api : https://ads.atmosphere.copernicus.eu to my lakehouse. I need either a file or a table. I tried so many things ! If someone has an idea ?   Than...
  • spencer_sa's avatar
    1 year ago

    Update:

    This code works and successfully downloads a zip file into a lakehouse.

    url='https://ads.atmosphere.copernicus.eu/api'
    key = 'Your API key'
    import cdsapi
    dataset = "cams-gridded-solar-radiation"
    request = {
        "variable": ["direct_normal_irradiation"],
        "sky_type": ["clear"],
        "version": ["4.6"],
        "year": ["2023"],
        "month": ["01"]
    }
    client = cdsapi.Client(url = url, key = key)
    a = client.retrieve(dataset, request,'/lakehouse/default/Files/Data/file.zip')

     

    If this helps, please consider Accepting as a Solution to help other people to find it.