jcheng31 / DarkSkyApi

An unofficial C# library for the Dark Sky weather service. Targets .NET Standard 1.1.
MIT License
32 stars 18 forks source link

How do we know if the limit was exceeded (license expired / account locked) on the response #27

Open barrytheunissen opened 6 years ago

barrytheunissen commented 6 years ago

After calling GetWeatherDataAsync for example, what property can we check to see if Dark Sky rejected the request because the account was locked out (limit exceeded) for example.

jcheng31 commented 6 years ago

Right now there isn't a definite way to know for sure - if the request had a non-successful status code, an exception is raised. There's also a ApiCallsMade property on the instance of the service which lets you see how many calls have been made so far (as reported by Dark Sky), though you'd have to implement some logic to figure out if you're nearing a limit using that.