Solcast/howto-pandas

``missing 1 required argument: 'api_key'`` while experimenting basic API call

bacloud23 opened this issue · 2 comments

Hi,
Following the tutorial, I am using Ubuntu, exported the SOLCAST_API_KEY in shell, and in the python environment of execution of the script, if this makes any difference.

I encountred the following error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-5-16263a0dce87> in <module>
      7 # install_date | format: yyyyMMdd Will be ignored if a loss_factor is supplied
      8 # latest | [True, False] | default False
----> 9 power_estimated_actuals = PowerFrameHandler.estimated_actuals(location, 5000, azimuth=0)
     10 power_estimated_actuals.pv_estimate.plot()
     11 

~/Bureau/Untitled Folder 1/solcast_frames/powerframehandler.py in estimated_actuals(lat_Lng, capacity, **kwargs)
     19         :rtype: pd.DataFrame
     20         """
---> 21         data = sc.PvPowerEstimatedActuals(lat_Lng.lat, lat_Lng.lng, capacity, **kwargs).content["estimated_actuals"]
     22         new_frame = pd.DataFrame(data)
     23         new_frame.set_index(['period_end'], inplace=True)

~/.conda/envs/tf/lib/python3.6/site-packages/solcast/pv_power_estimated_actuals.py in __init__(self, latitude, longitude, capacity, *args, **kwargs)
     35             self.end_point = self.end_point + '/latest'
     36 
---> 37         self._get(*args, **kwargs)
     38 
     39         if self.ok:

~/.conda/envs/tf/lib/python3.6/site-packages/solcast/base.py in _get(self, api_key, **kwargs)
     23         if api_key == None:
     24             raise TypeError('{type}() missing 1 required argument: \'api_key\''\
---> 25                             .format(type=type(self)))
     26 
     27         logger = logging.getLogger()

TypeError: <class 'solcast.pv_power_estimated_actuals.PvPowerEstimatedActuals'>() missing 1 required argument: 'api_key'

Thank you.

Thank you for bringing this up will run through the steps again to make sure Ubuntu is functioning as detailed.

Have you looked over the setup for the solcast-py library as it is used by this project?

This seems to work locally for me, can you run the following command on your terminal

printenv | grep SOLCAST_API_KEY and you should see something like this (have obfuscated the real key)

SOLCAST_API_KEY=Hz****