The WeatherService::getTimezoneGeo() silently uses a demo account which is throttled and often responds invalid data if quota has exceeded. This should be replaced by a real free service or the account being used should be configurable.

Comments

jurgenhaas created an issue. See original summary.

jrochate’s picture

The account can be created here:

http://www.geonames.org/

Then, the new username can be inserted on line 126 of src/WeatherService.php

NOTE: This will be overridden if module updates.

jeremiezip’s picture

StatusFileSize
new2.2 KB

Hello,
I wrote a patch for fix different problem with geonames webservice.
In the config form, now you can save your geonames username. (instead of default "demo" username).

Bye.

osab’s picture

I think #3 is mandatory for this project.
Without it I got error cURL error 6: Could not resolve host: ws.geonames.org (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

osab’s picture

Status: Active » Needs review
jeremiezip’s picture

StatusFileSize
new4.07 KB

Hello, this is my new version of geonames patch. I added a Try ... Catch... for avoid API crashes.
Thanks

jeremiezip’s picture

StatusFileSize
new4.59 KB

New version of patch : adding round temp min and round temp max (for avoid temperature displayed with this format : 15.6555°C)

Chris Charlton’s picture

+1

Chris Charlton’s picture

Title: getTimezoneGeo uses demo account » getTimezoneGeo uses demo account; geonames API URL update
Priority: Normal » Critical
Chris Charlton’s picture

Patch #7 was helpful.

blakemorgan’s picture

The patch in #7 does not apply for me using Composer or when I do it manually. I get the error (when running Composer with verbosity) Executing command (CWD): patch '-p4' --no-backup-if-mismatch -d 'web/modules/contrib/openweather' < '/tmp/5d042684a97dd.patch'. Am I the only one the patch doesn't work for?

jeremiezip’s picture

Hello Blakemorgan,

This patch works with the dev version. Maybe your problem is here ?

Chris Charlton’s picture

RTBC, anyone else?

prashant114606’s picture

Status: Needs review » Needs work
StatusFileSize
new148.59 KB

I see the issue with the syntax. please check the attached SS for more information.

<stdin>:55: trailing whitespace.
        $query['username'] = $geonames_username_config;
<stdin>:57: trailing whitespace.
      // By default "demo" value with a limit
<stdin>:58: trailing whitespace.
        $query['username'] = 'demo';
<stdin>:66: space before tab in indent.
     	return FALSE;
<stdin>:70: space before tab in indent.
    	return simplexml_load_string($timezone->getBody()->getContents());
warning: squelched 5 whitespace errors
warning: 10 lines add whitespace errors.

generalredneck’s picture

Status: Needs work » Fixed

I did the cleanup here and got it committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.