Green-Software-Foundation / carbon-aware-sdk

Carbon-Aware SDK
https://carbon-aware-sdk.greensoftware.foundation/
MIT License
484 stars 99 forks source link

[Bug]: WattTime as Data Source results in 403 Forbidden #566

Closed jacksorjacksor closed 1 month ago

jacksorjacksor commented 2 months ago

Contact Details

richard.jackson@nightingalehq.ai

What happened?

I'm attempting to use my WattTime account as a data source for the Carbon Aware SDK as described here. I'm providing my username and password but am still receiving 403 forbidden responses.

I'm wondering if there's a requirement to provide extra authorisation details such as the generated bearer tokens as described in the WattTime documentation.

Thanks!

client

WebAPI (Default)

Relevant log output

fail: CarbonAware.DataSources.WattTime.Client.WattTimeClient[0]
      Error getting data from WattTime.  StatusCode: Forbidden. Response: StatusCode: 403, ReasonPhrase: 'Forbidden', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:
      {
        Server: CloudFront
        Date: Thu, 19 Sep 2024 14:55:16 GMT
        Connection: keep-alive
        X-Cache: Error from cloudfront
        Via: 1.1 7c0d7bdd893a9beec35b3b279c41bc56.cloudfront.net (CloudFront)
        X-Amz-Cf-Pop: LHR5-P7
        X-Amz-Cf-Id: VQsaidRSf8hnpkCDsg3Y6nCMa2aIDiD7rQk866cvI45scItujW_5rg==
        Content-Type: text/html
        Content-Length: 919
      }

Code of Conduct

danuw commented 1 month ago

Hi, have you updated your settings to use v3 instead of v2 please?

https://carbon-aware-sdk.greensoftware.foundation/blog/release-v1.5#changed

Though since it is a 403, is it worth trying to make a request to the API directly to verify the credentials? https://docs.watttime.org/

let us know how it goes...

jacksorjacksor commented 1 month ago

Hey @danuw - ah that config pattern has worked, thank you!

Much appreciated, Rich