GithubHelp home page GithubHelp logo

jcheng31 / darkskyapi Goto Github PK

View Code? Open in Web Editor NEW
33.0 33.0 18.0 643 KB

An unofficial C# library for the Dark Sky weather service. Targets .NET Standard 1.1.

License: MIT License

C# 100.00%
c-sharp cross-platform dark-sky darksky darksky-api net-standard nuget weather-service

darkskyapi's People

Contributors

codeanimal avatar fourtonmantis avatar grendello avatar ievangelist avatar jcheng31 avatar lynnroth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

darkskyapi's Issues

Missing UV index

Hello,

It seems that the uvIndex and uvIndexTime information is missing on Data Point Object.
I've seen that the property is available when I make an HTTP request from a browser.

See the official doc

System.Runtime.Serialization.SerializationException

There seems to be a problem retrieving weather data for international locations using this library. When I use this code:
var fc = new ForecastIOPortable.ForecastApi(<API key>);
Forecast ForecastData = await fc.GetWeatherDataAsync(latitude, longitude,units,ForecastIOPortable.Language.English);

That code works perfectly fine for US, UK, etc locations, but when I try a place like Mumbai, India, I get the exception mentioned above.

Exception Details:
There was an error deserializing the object of type ForecastIOPortable.Models.Forecast. Input string was not in a correct format.

Note that this is just came up in the 1.5 release of my extremely popular WP weather app Atmosphere. Can you please look into this issue ASAP before I lose more international users?

Compiling with .NET Native toolchain causes InvalidDataContractException during serialization

Using this library in a Windows 10 app which compiles against the .NET Native toolchain, I'm getting an InvalidDataContractException in ForecastApi.ParseForecastFromResponse when the call to serializer.ReadObject is being made:

Type 'ForecastIOPortable.Models.Forecast' cannot be serialized, serialization code for the type is missing. Consult the SDK documentation for adding it as a root serialization type.

I've tried adding various runtime directives but so far none of them have worked. Adding @MattWhilden on the .NET Native team to take a look.

UK2 Unit value

The "uk" unit was in the old documentation. The "uk2" unit type has now replaced that in the documentation and it is technically more appropriate - as it will return nearestStormDistance and visibility in miles and not kilometres.

I suggest add a new enum value Unit.UK2 which returns "uk2" when invoking the ToValue extension method.

Thread Deadlock issue in ASP.NET

I've come across an annoying deadlock issue when using the library in an ASP.NET request context (this could apply to any UI context too). The issue is that the HttpClient method GetAsync is deadlocking.

Ref. article: Don't Block on Async Code

To fix the issue I can to call ConfigureAwait(false) after the call to GetAsync, which stopped the deadlocking. According to Stephen Cleary, this is recommended anyway (see article above).

Problem Accessing GetWeatherDataAsync

Hello,

We are using your nuget package to consume DarkSkyApi.

We have this code :

var client = new DarkSkyService(apiKey);
Task taskWeatherData = client.GetWeatherDataAsync(latitudeAsDouble, longitudeAsDouble, Unit.CA, extendList, exclusionList, Language.French);
taskWeatherData.Wait();
var forecastWeather = taskWeatherData.Result;

Since few days we have an exception on Wait procedure. (HttpRequestException, WebException, IOException, SocketException).

We have tried with several apiKy and Several latitude and longitude.
The URL : https://api.darksky.net/forecast/b26c2949a2e9ffa9cfaa62183ed2c0c7/48.5586242184,2.43753236038 is working fine.

Do you have any explanation about that problem?

Thank you for your help.

string format in czech locale

Hi
I've faced with problem with decimal separator in czech locale - it is a "," but not "."
So, as result, "https://api.forecast.io/forecast/{0}/{1},{2}?units={3}&extend={4}&exclude={5}&lang={6}" will be formatted as "https://api.forecast.io/forecast/APIKEY/50,029,14,49?units=....."

workaround for now:

CultureInfo ci = Thread.CurrentThread.CurrentCulture;
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
_forecast = await _forecastClient.GetWeatherDataAsync(_lat, _longt, units, language);
Thread.CurrentThread.CurrentCulture = ci;

Regards
Dmitry Belov

Add Windows 10 support

First off, thanks for creating this library! Super useful.

When I upgraded my Windows 8.1 app to a Windows 10 universal app I got the following error when trying to add your NuGet package:

Not compatible with UAP,Version=v10.0 (win10-x64-aot)

Add new languages

Italian, Polish, Pig Latin, Portuguese, and Bosnian are now supported by Forecast. These should be added to the Languages enum.

Missing severity on Alerts class

Might be a new item on the Alerts definition, but doesn't seem to be defined in the Forecast class

https://darksky.net/dev/docs#response-format

Alerts Array

The alerts array contains objects representing the severe weather warnings issued for the requested location by a governmental authority (please see our data sources page for a list of sources). Objects in the alerts array contain the following properties:

description required
A detailed description of the alert.
expires required
The UNIX time at which the alert will expire.
regions required
An array of strings representing the names of the regions covered by this weather alert.
severity required
The severity of the weather alert. Will take one of the following values: "advisory" (an individual should be aware of potentially severe weather), "watch" (an individual should prepare for potentially severe weather), or "warning" (an individual should take immediate action to protect themselves and others from potentially severe weather).

time required
The UNIX time at which the alert was issued.
title required
A brief description of the alert.
uri required
An HTTP(S) URI that one may refer to for detailed information about the alert.

No Celsius

Is there an option that allows you to use Celsius instead of Fahrenheit like the website?
I could use a regex and then convert it, however it there was more than one set of numbers in the Daily Summary, I could create issues.

issue with await

Hi, I've installed via nugget into an Umbraco 7 project. However, I've received the following error:
Error CS4033 The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'.

for line: Forecast result = await client.GetWeatherDataAsync(37.8267, -122.423);

(I am following your Quick start guide)
Any ideas how to resolve this error?

Debug configuration test FAILED

Hi - I've updated lib to version 2.3.0(Windows Phone Silverlight 8.1) and got a certification error in dev center:

Debug configuration test
FAILED
Debug configuration
•Error Found: The debug configuration test detected the following errors:◦The binary ForecastPCL.dll is built in debug mode.
•Impact if not fixed: Windows Phone Store doesn’t allow a debug version of an app.
•How to fix: Please make sure the app isn't linking to any debug versions of a framework and it is built with the release configuration with optimization enabled.

Best regards
Dmitry Belov
BK Labs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.