bartimeys / python-weather-api Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/python-weather-api
License: MIT License
Automatically exported from code.google.com/p/python-weather-api
License: MIT License
What steps will reproduce the problem?
1.does not work with urllib3
2.worked on older systems.
3.
What is the expected output? What do you see instead?
errors
What version of the product are you using? On what operating system?
debian wheezy
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 4 Sep 2012 at 2:52
Google's API will accept locations with spaces (e.g. "London, England" instead
of
"London,England"). If you try this, you get:
>>> pywapi.get_weather_from_google('london, england')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pywapi.py", line 51, in get_weather_from_google
handler = urllib2.urlopen(url)
File "/usr/lib/python2.5/urllib2.py", line 124, in urlopen
return _opener.open(url, data)
File "/usr/lib/python2.5/urllib2.py", line 387, in open
response = meth(req, response)
File "/usr/lib/python2.5/urllib2.py", line 498, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.5/urllib2.py", line 425, in error
return self._call_chain(*args)
File "/usr/lib/python2.5/urllib2.py", line 360, in _call_chain
result = func(*args)
File "/usr/lib/python2.5/urllib2.py", line 506, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 400: Bad Request
If you cal urllib.quote on the location_id before generating the URL, then it
fixes it.
Original issue reported on code.google.com by [email protected]
on 25 Aug 2009 at 6:09
Added a new function, get_everything_from_google(country_code, hl) which
fetches all the available data for all the cities of a specific country.
Original issue reported on code.google.com by [email protected]
on 16 Sep 2010 at 10:40
Attachments:
What steps will reproduce the problem?
1. live in the United Kingdom using weather.com code UKXX1695
2. using this programme http://blog.jacobean.net/?p=1016
3.
What is the expected output? What do you see instead?
at Midnight UK Time the day changes over but the date part doesnt
What version of the product are you using? On what operating system?
latest raspian 20/07/2014 Raspberry Pi
Please provide any additional information below.
The date number seems to change some 4-5 hrs later so at 04:00 or 05:00 hrs the
date part will catch up.
so at midnight it will say Wednesday 29th June 2014
then at 04:00 or 05:00hrs it will correct it self, not sure if it is defaulting
to USA Time.
Many Thanks
Tony
Original issue reported on code.google.com by [email protected]
on 30 Jul 2014 at 6:59
What version of the product are you using? On what operating system?
pywapi-0.3.6
Please provide any additional information below.
>>> import pywapi
>>> pywapi.get_weather_from_yahoo('2502265', units='metric')
{'error': u'City not found'}
>>> pywapi.get_location_ids('Sunnyvale')
{u'USNC4980': u'Sunnyvale, NC', u'USCA1116': u'Sunnyvale, CA', u'USCO1607':
u'Sunnyvale, CO', u'USTX1319': u'Sunnyvale, TX', u'NZXX2873': u'Sunnyvale, OTA,
New Zealand', u'USMO3789': u'Sunnyvale, MO', u'USUT2816': u'Sunnyvale Heights,
UT', u'USUT2817': u'Sunnyvale Park, UT'}
>>> pywapi.get_weather_from_yahoo('USCA1116', units='metric')
{'html_description': u'\n<img src="http://l.yimg.com/a/i/us/we/52/26.gif"/><br
/>\n<b>Current Conditions:</b><br />\nCloudy, 13 C<BR />\n<BR
/><b>Forecast:</b><BR />\nSun - Partly Cloudy. High: 18 Low: 11<br />\nMon -
Mostly Sunny. High: 16 Low: 8<br />\nTue - Partly Cloudy. High: 17 Low: 8<br
/>\nWed - Partly Cloudy. High: 17 Low: 8<br />\nThu - Sunny. High: 21 Low: 9<br
/>\n<br />\n<a
href="http://us.rd.yahoo.com/dailynews/rss/weather/Sunnyvale__CA/*http://weather
.yahoo.com/forecast/USCA1116_c.html">Full Forecast at Yahoo!
Weather</a><BR/><BR/>\n(provided by <a href="http://www.weather.com" >The
Weather Channel</a>)<br/>\n', 'atmosphere': {'pressure': u'1015.8', 'rising':
u'2', 'visibility': u'14.48', 'humidity': u'80'}, 'title': u'Yahoo! Weather -
Sunnyvale, CA', 'condition': {'date': u'Sun, 27 Oct 2013 9:56 am PDT', 'text':
u'Cloudy', 'code': u'26', 'temp': u'13', 'title': u'Conditions for Sunnyvale,
CA at 9:56 am PDT'}, 'forecasts': [{'code': u'30', 'text': u'Partly Cloudy',
'high': u'18', 'low': u'11', 'date': u'27 Oct 2013', 'day': u'Sun'}, {'code':
u'34', 'text': u'Mostly Sunny', 'high': u'16', 'low': u'8', 'date': u'28 Oct
2013', 'day': u'Mon'}, {'code': u'30', 'text': u'Partly Cloudy', 'high': u'17',
'low': u'8', 'date': u'29 Oct 2013', 'day': u'Tue'}, {'code': u'30', 'text':
u'Partly Cloudy', 'high': u'17', 'low': u'8', 'date': u'30 Oct 2013', 'day':
u'Wed'}, {'code': u'32', 'text': u'Sunny', 'high': u'21', 'low': u'9', 'date':
u'31 Oct 2013', 'day': u'Thu'}], 'link':
u'http://us.rd.yahoo.com/dailynews/rss/weather/Sunnyvale__CA/*http://weather.yah
oo.com/forecast/USCA1116_c.html', 'location': {'city': u'Sunnyvale', 'region':
u'CA', 'country': u'US'}, 'units': {'distance': u'km', 'speed': u'km/h',
'temperature': u'C', 'pressure': u'mb'}, 'astronomy': {'sunset': u'6:15 pm',
'sunrise': u'7:26 am'}, 'geo': {'lat': u'37.39', 'long': u'-122.03'}, 'wind':
{'direction': u'110', 'speed': u'8.05', 'chill': u'13'}}
>>> pywapi.get_weather_from_weather_com('USCA1116', units='metric')
{'units': {'distance': u'km', 'speed': u'km/h', 'temperature': u'C',
'rainfall': u'mm', 'pressure': u'mb'}, 'current_conditions': {'moon_phase':
{'text': u'Last Quarter', 'icon': u'22'}, 'last_updated': u'10/27/13 10:05 AM
PDT', 'temperature': u'13', 'dewpoint': u'9', 'text': u'Cloudy', 'uv':
{'index': u'1', 'text': u'Low'}, 'visibility': u'14.5', 'humidity': u'80',
'station': u'Moffett Field, CA, US', 'barometer': {'direction': u'falling',
'reading': u'1015.58'}, 'feels_like': u'13', 'wind': {'gust': u'N/A',
'direction': u'110', 'speed': u'8', 'text': u'ESE'}, 'icon': u'26'},
'location': {'lat': u'37.37', 'lon': u'-122.03', 'name': u'Sunnyvale, CA'},
'forecasts': [{'day_of_week': u'Sunday', 'high': u'18', 'sunset': u'9:15 PM',
'low': u'11', 'night': {'brief_text': u'P Cloudy', 'text': u'Partly Cloudy',
'chance_precip': u'20', 'humidity': u'78', 'wind': {'gust': u'N/A',
'direction': u'270', 'speed': u'23', 'text': u'W'}, 'icon': u'29'}, 'date':
u'Oct 27', 'day': {'brief_text': u'P Cloudy', 'text': u'Partly Cloudy',
'chance_precip': u'0', 'humidity': u'65', 'wind': {'gust': u'N/A', 'direction':
u'314', 'speed': u'18', 'text': u'NW'}, 'icon': u'30'}, 'sunrise': u'10:28
AM'}, {'day_of_week': u'Monday', 'high': u'16', 'sunset': u'9:15 PM', 'low':
u'8', 'night': {'brief_text': u'M Clear', 'text': u'Mostly Clear',
'chance_precip': u'10', 'humidity': u'84', 'wind': {'gust': u'N/A',
'direction': u'206', 'speed': u'13', 'text': u'SSW'}, 'icon': u'33'}, 'date':
u'Oct 28', 'day': {'brief_text': u'M Sunny', 'text': u'Mostly Sunny',
'chance_precip': u'20', 'humidity': u'74', 'wind': {'gust': u'N/A',
'direction': u'296', 'speed': u'18', 'text': u'WNW'}, 'icon': u'34'},
'sunrise': u'10:28 AM'}, {'day_of_week': u'Tuesday', 'high': u'17', 'sunset':
u'9:15 PM', 'low': u'8', 'night': {'brief_text': u'M Clear', 'text': u'Mostly
Clear', 'chance_precip': u'0', 'humidity': u'73', 'wind': {'gust': u'N/A',
'direction': u'343', 'speed': u'3', 'text': u'NNW'}, 'icon': u'33'}, 'date':
u'Oct 29', 'day': {'brief_text': u'P Cloudy', 'text': u'Partly Cloudy',
'chance_precip': u'0', 'humidity': u'72', 'wind': {'gust': u'N/A', 'direction':
u'232', 'speed': u'11', 'text': u'SW'}, 'icon': u'30'}, 'sunrise': u'10:28
AM'}, {'day_of_week': u'Wednesday', 'high': u'17', 'sunset': u'9:15 PM', 'low':
u'8', 'night': {'brief_text': u'Clear', 'text': u'Clear', 'chance_precip':
u'0', 'humidity': u'59', 'wind': {'gust': u'N/A', 'direction': u'118', 'speed':
u'5', 'text': u'ESE'}, 'icon': u'31'}, 'date': u'Oct 30', 'day': {'brief_text':
u'P Cloudy', 'text': u'Partly Cloudy', 'chance_precip': u'0', 'humidity':
u'53', 'wind': {'gust': u'N/A', 'direction': u'18', 'speed': u'14', 'text':
u'NNE'}, 'icon': u'30'}, 'sunrise': u'10:28 AM'}, {'day_of_week': u'Thursday',
'high': u'21', 'sunset': u'9:15 PM', 'low': u'9', 'night': {'brief_text':
u'Clear', 'text': u'Clear', 'chance_precip': u'0', 'humidity': u'55', 'wind':
{'gust': u'N/A', 'direction': u'5', 'speed': u'5', 'text': u'N'}, 'icon':
u'31'}, 'date': u'Oct 31', 'day': {'brief_text': u'Sunny', 'text': u'Sunny',
'chance_precip': u'0', 'humidity': u'50', 'wind': {'gust': u'N/A', 'direction':
u'12', 'speed': u'13', 'text': u'NNE'}, 'icon': u'32'}, 'sunrise': u'10:28
AM'}]}
Original issue reported on code.google.com by [email protected]
on 27 Oct 2013 at 5:36
What steps will reproduce the problem?
any error in urllib2.urlopen (DNS, etc.)
What is the expected output? What do you see instead?
expect empty data, not error
where to handle exception? in pywapi x outside
What version of the product are you using? On what operating system?
version 0.22
Please provide any additional information below.
old code:
handler = urllib2.urlopen(url)
new code:
try: handler = urllib2.urlopen(url)
except urllib2.URLError: return {}
or:
try: handler = urllib2.urlopen(url)
except: return {}
Original issue reported on code.google.com by [email protected]
on 7 Feb 2011 at 9:30
Even using the latest commit from trunk, there are still issues with Python3
compatibility. For instance:
>>> import pywapi
>>> pywapi.get_loc_id_from_weather_com('new york, ny')
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/usr/lib/python3/dist-packages/pywapi.py", line 788, in get_loc_id_from_weather_com
search_string = unidecode(search_string.decode('utf-8'))
AttributeError: 'str' object has no attribute 'decode'
I can confirm this with both py3.2 on Debian unstable and py3.3 on Ubuntu
raring.
Original issue reported on code.google.com by [email protected]
on 29 May 2013 at 10:15
Can you please add return values for the Sky Conditions like:
where:
SKY_COVER = { "SKC":"clear",
"CLR":"clear",
"NSC":"clear",
"NCD":"clear",
"FEW":"a few ",
"SCT":"scattered ",
"BKN":"broken ",
"OVC":"overcast",
"///":"",
"VV":"indefinite ceiling" }
And height of the clouds is:
height = distance(int(height)*100,"FT"
FEW035, SKC, SCT120
Can be a mix like: FEW004 SCT022 BKN03
The precipitation values for the last 1hr 3hr and 6hr
Heat index temp FAHRENHEIT.
Temperature history max min, FAHRENHEIT
See :http://w1.weather.gov/obhistory/KBOW.html for a reference of the values
Thanks.
Original issue reported on code.google.com by [email protected]
on 31 Jul 2014 at 8:52
List of countries: http://www.google.com/ig/countries?output=xml&hl=de
List of cities: http://www.google.com/ig/cities?output=xml&hl=ru&country=de
Original issue reported on code.google.com by [email protected]
on 10 Aug 2009 at 8:33
Python 2.7.1 (r271:86832, Feb 21 2011, 01:26:25)
[GCC 4.5.2 20110127 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pywapi
>>> pywapi.get_cities_from_google('us')
[]
Original issue reported on code.google.com by [email protected]
on 25 Apr 2011 at 11:27
The JSON response from yahoo is incorrectly decoded in get_woeid_from_yahoo():
Traceback (most recent call last):
File "/usr/bin/indicator-weather", line 2690, in next_page
(result, error_type) = self.location.prepare_location(self.place_selected)
File "/usr/bin/indicator-weather", line 360, in prepare_location
self.prepare_location_for_yahoo(geonames_details)
File "/usr/bin/indicator-weather", line 430, in prepare_location_for_yahoo
woeid_result = pywapi.get_woeid_from_yahoo(displayed_city_name)
File "/usr/lib/python2.7/dist-packages/pywapi.py", line 906, in get_woeid_from_yahoo
json_response = handler.read().decode()
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 121:
ordinal not in range(128)
To fix, just change the referenced line to:
json_response = handler.read()
(i.e. don't call .decode() on the response)
Original issue reported on code.google.com by [email protected]
on 16 Jul 2013 at 4:46
0.3.8-0ubuntu0ppa1 from launchpad depends on python:any (>= 2.7.1-0ubuntu2)
and it prevent to install the package to Debian wheezy that have python
2.7.3-4+deb7u1
Original issue reported on code.google.com by [email protected]
on 26 Apr 2014 at 10:21
What steps will reproduce the problem?
1. Run the pywapi-noaa-example.py when there NOAA isn't reporting one of the
items in the
data structure--heat_index_f, for example.
What is the expected output? What do you see instead?
The example fails with an IndexError at line 209 instead of running to
completion.
What version of the product are you using? On what operating system?
Python 2.5.1 on a Macintosh OS X 10.5.7.
Please provide any additional information below.
Use this try/except block in get_weather_from_noaa
for tag in data_structure:
try:
weather_data[tag] = current_observation.getElementsByTagName(tag)[0].firstChild.data
except IndexError:
weather_data[tag] = ''
Original issue reported on code.google.com by [email protected]
on 16 Jun 2009 at 2:48
What steps will reproduce the problem?
1.call: weather = pywapi.get_weather_from_google('Bourget+du+lac')
2.or call for any city that will have an accentuated character in the name
3.
What is the expected output? What do you see instead?
Bad handling of utf-8, or accentuated character
What version of the product are you using? On what operating system?
latest version, ubuntu 10.10
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 5 Jan 2011 at 11:23
Wind parsing in the get_weather_from_weather_com fails. Here's the stack trace
…
Exception in Thread-3 at Mon Mar 23 13:53:52 2015
Traceback (most recent call last):
...
File "/usr/lib/python3.4/site-packages/i3pystatus/weather.py", line 45, in run
result = pywapi.get_weather_from_weather_com(self.location_code, self.units)
File "/usr/lib/python3.4/site-packages/pywapi.py", line 239, in get_weather_from_weather_com
'wind')[0].getElementsByTagName(tag2)[0].firstChild.data
AttributeError: 'NoneType' object has no attribute 'data'
The fetched data from weather.com is attached (AUXX0010.xml).
Original issue reported on code.google.com by [email protected]
on 23 Mar 2015 at 1:24
Attachments:
python-pywapi 0.3.8 (I assume stable) builds and installs fine on Ubuntu 14.04.
Necessary for indicator-weather to work via apt. Can someone add support for
it to the PPA?
Original issue reported on code.google.com by [email protected]
on 6 Apr 2015 at 2:49
Add: http://www.weather.gov/xml/current_obs/seek.php?state=fl&Find=Find
Original issue reported on code.google.com by [email protected]
on 22 May 2009 at 10:04
What steps will reproduce the problem?
1. The problem is random and only arises when the 'wind' attribute is empty.
2. n/a
3. n/a
What is the expected output? What do you see instead?
Traceback (most recent call last):
File "weather.py", line 386, in <module>
myDisp.UpdateWeather()
File "weather.py", line 91, in UpdateWeather
w = pywapi.get_weather_from_weather_com( '16601', units='imperial' )
File "/usr/local/lib/python2.7/dist-packages/pywapi.py", line 239, in get_weather_from_weather_com
'wind')[0].getElementsByTagName(tag2)[0].firstChild.data
AttributeError: 'NoneType' object has no attribute 'data'
What version of the product are you using? On what operating system?
pywapi-0.3.8 on both Ubuntu 14.04 and Raspberry Pi Debian Wheezy
Please provide any additional information below.
This error does not appear 100% of the time. It only pops up when the 'wind'
tag is empty/missing.
Original issue reported on code.google.com by [email protected]
on 21 Jul 2014 at 10:08
It might be more useful if each get_weather_from_ function returned the
same array or dictionary so programs could be written more generically (for
example, the user selects which provider, which only changes the
get_weather_from_ function that's used to request information). Even if
some fields were blank for some providers, it would be a better interface
to use.
Original issue reported on code.google.com by [email protected]
on 20 Nov 2009 at 2:24
Beginning a few days ago (around 2013-10-24), get_location_ids() no longer
works for most cities.
For instance, help(pywapi.get_location_ids) suggests using 'Los Angeles' as a
search string. pywapi.get_location_ids("Los Angeles") gives a warning about
'str' not being a unicode object, and returns [].
pywapi.get_location_ids(u"Los Angeles") returns [] without the warning.
The problem seems to be that the server (Yahoo?) is no longer accepting spaces
in location names. If I truncate the name at the first space,
pywapi.get_location_ids(u"Los") does return a list of IDs which includes
(u'USCA0638', u'Los Angeles, CA') as the first item.
But that workaround doesn't work for all cities, because it only returns at
most 10 results, so if you need to search for something like "Los" or "Santa"
there's no guarantee of getting the city you want in the first 10 results.
I'm not sure if there's any solution for this (I know you don't control the
server and this isn't pywapi's fault) but I wanted to make sure you knew about
the problem. Maybe there's a clever workaround that I haven't found yet. I hope
so -- pywapi is a super useful library.
This is with the pywapi currently in pip, under Debian sid and Python 2.7.5.
Original issue reported on code.google.com by akkana
on 27 Oct 2013 at 4:34
I think there is a typo in code, pywapi.py#L749
http://bazaar.launchpad.net/~pywapi-devel/python-weather-api/trunk/view/head:/py
wapi.py#L749
really should be 3.3 not 3.4.
Original issue reported on code.google.com by zpsigma
on 3 Apr 2014 at 8:46
http://code.google.com/intl/zh-
CN/apis/gears/geolocation_network_protocol.html
Original issue reported on code.google.com by [email protected]
on 10 Aug 2009 at 8:43
Now that distributions like Ubuntu are beginning the transition, it's time to
take this step. Not saying to deprecate the Python 2 version, btw.
Not a dev, but happy to test!
Original issue reported on code.google.com by [email protected]
on 19 Nov 2012 at 9:36
What steps will reproduce the problem?
1.Try an invalid location
What is the expected output? What do you see instead?
A "success" variable being false is preferable; none exists
Original issue reported on code.google.com by [email protected]
on 22 Aug 2012 at 10:52
What steps will reproduce the problem?
1. Call "get_weather_from_google" multiple times.
Sometimes you can retrieve values and sometimes you end up with "Unsupported
API". Since it is generally working, Google seems to have servers, that do not
answer to pywapi any more.
In [11]: cW.weatherCheck()
<?xml version="1.0"?><xml_api_reply version="1"><weather module_id="0"
tab_id="0" mobile_row="0" mobile_zipped="1" row="0" section="0"
><forecast_information><city data="Würselen, North
Rhine-Westphalia"/><postal_code data="Wuerselen"/><latitude_e6
data=""/><longitude_e6 data=""/><forecast_date
data="2012-08-24"/><current_date_time data="1970-01-01 00:00:00
+0000"/><unit_system
data="US"/></forecast_information><current_conditions><condition
data="Clear"/><temp_f data="75"/><temp_c data="24"/><humidity data="Humidity:
44%"/><icon data="/ig/images/weather/sunny.gif"/><wind_condition data="Wind: S
at 6 mph"/></current_conditions><forecast_conditions><day_of_week
data="Fri"/><low data="57"/><high data="79"/><icon
data="/ig/images/weather/chance_of_rain.gif"/><condition data="Chance of
Rain"/></forecast_conditions><forecast_conditions><day_of_week data="Sat"/><low
data="55"/><high data="77"/><icon
data="/ig/images/weather/chance_of_rain.gif"/><condition data="Chance of
Rain"/></forecast_conditions><forecast_conditions><day_of_week data="Sun"/><low
data="50"/><high data="70"/><icon
data="/ig/images/weather/chance_of_rain.gif"/><condition data="Chance of
Rain"/></forecast_conditions><forecast_conditions><day_of_week data="Mon"/><low
data="57"/><high data="75"/><icon
data="/ig/images/weather/mostly_sunny.gif"/><condition data="Mostly
Sunny"/></forecast_conditions></weather></xml_api_reply>
(u'24', 44, 'S', 6, u'Clear')
In [12]: cW.weatherCheck()
Unsupported API
---------------------------------------------------------------------------
ExpatError Traceback (most recent call last)
/home/pmichalschik/Python/testlib/<ipython-input-12-9bf3a48fa2e2> in <module>()
----> 1 cW.weatherCheck()
/home/pmichalschik/Python/testlib/checkWeatherCondition.pyc in weatherCheck()
88
89 W = weatherCondition.Weather()
---> 90 W.updateWeatherCondition()
91
92 humidityValue, windDir, windSpeed = formatOutput(W.getHumidityinPercent(),W.getWindSpeedInMph())
/home/pmichalschik/Python/testlib/weatherCondition.pyc in
updateWeatherCondition(self, place)
12
13 def updateWeatherCondition(self,place='Wuerselen'):
---> 14 weather = pywapi.get_weather_from_google(place)
15 self.tempInC = weather['current_conditions']['temp_c']
16 self.humidityinPercent = weather['current_conditions']['humidity']
/usr/local/lib/python2.7/dist-packages/pywapi.py in
get_weather_from_google(location_id, hl)
64 xml_response = handler.read()
65 print xml_response
---> 66 dom = minidom.parseString(xml_response)
67 handler.close()
68
/usr/lib/python2.7/xml/dom/minidom.py in parseString(string, parser)
1928 if parser is None:
1929 from xml.dom import expatbuilder
-> 1930 return expatbuilder.parseString(string)
1931 else:
1932 from xml.dom import pulldom
/usr/lib/python2.7/xml/dom/expatbuilder.py in parseString(string, namespaces)
938 else:
939 builder = ExpatBuilder()
--> 940 return builder.parseString(string)
941
942
/usr/lib/python2.7/xml/dom/expatbuilder.py in parseString(self, string)
221 parser = self.getParser()
222 try:
--> 223 parser.Parse(string, True)
224 self._setup_subset(string)
225 except ParseEscape:
ExpatError: syntax error: line 1, column 0
Original issue reported on code.google.com by [email protected]
on 24 Aug 2012 at 2:26
http://blog.emerick.org/2008/05/07/google-weather-api-feed-documentation/
Original issue reported on code.google.com by [email protected]
on 12 May 2009 at 9:49
Script:
{{import pywapi
import pprint
pp = pprint.PrettyPrinter(indent=4)
result = pywapi.get_weather_from_google('10001', 'zh-cn')
pp.pprint(result)
}}
Result:
{{
[04:54:33][root@li51-150:/home/qetzal/python/python-weather-api]# python
pywapi-google-example.py
Traceback (most recent call last):
File "pywapi-google-example.py", line 5, in <module>
result = pywapi.get_weather_from_google('10001', 'zh-cn')
File "/home/qetzal/python/python-weather-api/pywapi.py", line 52, in
get_weather_from_google
dom = minidom.parse(handler)
File "/usr/local/lib/python2.6/xml/dom/minidom.py", line 1918, in parse
return expatbuilder.parse(file)
File "/usr/local/lib/python2.6/xml/dom/expatbuilder.py", line 928, in
parse
result = builder.parseFile(file)
File "/usr/local/lib/python2.6/xml/dom/expatbuilder.py", line 207, in
parseFile
parser.Parse(buffer, 0)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1,
column 428
}}
Original issue reported on code.google.com by [email protected]
on 10 Aug 2009 at 8:56
http://informer.gismeteo.ru/xml/27612_1.xml
http://rp5.ru/docs/xml/ru?id=5483
Original issue reported on code.google.com by [email protected]
on 27 May 2009 at 4:55
pywapi.get_weather_from_weather_com( "US Zip" , imperial ) isn't returning
data anymore. I'm just getting an error message.
Traceback (most recent call last):
File "pywapi-weather-com-example.py", line 7, in <module>
kalamata = pywapi.get_weather_from_weather_com('USOR0169', 'imperial')
File "/usr/local/lib/python2.7/dist-packages/pywapi.py", line 212, in get_weather_from_weather_com
tag)[0].firstChild.data
AttributeError: 'NoneType' object has no attribute 'data'
It still works with the default GRXX0036 location
Original issue reported on code.google.com by [email protected]
on 19 Jan 2014 at 8:16
What steps will reproduce the problem?
1. Install trunk
2. Try to import pywapi
3. Get ImportError about urllib.request
What is the expected output? What do you see instead?
Expect to be able to import pywapi, instead get an ImportError.
What version of the product are you using? On what operating system?
Python 2.6
Please provide any additional information below.
If Python 3.X is required for running trunk, it'd be nice to let users know.
Original issue reported on code.google.com by [email protected]
on 2 Mar 2012 at 10:51
Yahoo recommends changing the city code paramater from 'p' to 'w'. 'p' is
deprecated.
See http://developer.yahoo.com/weather/ just underneath the section
REQUEST PARAMETERS.
Using 'p' does not work for my city in Australia. It may still work for
US cities. 'w' does work for my city.
Edit examples/pywapi-example.py to use Swanbourne, Australia as weather
code (1098737)
Run python examples/pywapi-example.py
The expected output is some weather info, the actual error is an
IndexError traceback.
Version is python 2.4.4 (version shouldn't matter in this case)
OS is dreamhost.com's, which is some sort of Linux running in a VM,
apparently.
Original issue reported on code.google.com by [email protected]
on 4 Jan 2010 at 2:15
If the XML returned from Weather.com contains empty (but valid) tags, the call
to get_weather_from_weather_com() raises an AttributeError with the following
message:
>>> pywapi.get_weather_from_weather_com('AUX0025')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/pywapi.py", line 186, in get_weather_from_weather_com
tag)[0].getElementsByTagName(tag2)[0].firstChild.data
AttributeError: 'NoneType' object has no attribute 'data'
Original issue reported on code.google.com by [email protected]
on 11 Feb 2014 at 3:46
Using python 2 everything works as expected:
$ python
Python 2.7.3 (default, Jan 13 2013, 11:20:46)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pywapi
>>> weather = pywapi.get_weather_from_weather_com('GMXX3828')
>>>
But in python3 I get the following error:
$ python3
Python 3.2.3 (default, Mar 1 2013, 11:53:50)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pywapi
>>> weather = pywapi.get_weather_from_weather_com('GMXX3828')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.2/dist-packages/pywapi.py", line 212, in get_weather_from_weather_com
tag)[0].firstChild.data
AttributeError: 'NoneType' object has no attribute 'data'
>>>
Anyone got an idea what went wrong? It does not happen for all stations, just
for a few.
Thanks in advance
Original issue reported on code.google.com by [email protected]
on 26 Feb 2014 at 3:39
I wrote some code that can get forecast from www.weather.com
And I want to share it.
Original issue reported on code.google.com by alexeytech
on 18 Oct 2009 at 7:27
Attachments:
Version 0.3.5. Python 3 on Arch Linux.
Tests:
weather_com_result = pywapi.get_weather_from_weather_com('10001')
yahoo_result = pywapi.get_weather_from_yahoo('10001')
noaa_result = pywapi.get_weather_from_noaa('KJFK')
Only the first test fails:
File "/usr/lib/python3.3/site-packages/pywapi.py", line 203, in get_weather_from_weather_com
if weather_dom.getElementsByTagName('dayf') > 0:
TypeError: unorderable types: NodeList() > int()
Test does not fail with version 0.3.4.
Original issue reported on code.google.com by [email protected]
on 13 Aug 2013 at 6:19
It may be useful to be able to force using of Celsius in the results. E.g.
google returns Fahrenheit for forecasts which is unusable in non-us countries.
Original issue reported on code.google.com by [email protected]
on 7 Sep 2011 at 6:51
The Python Package Index is the repository of software for the Python
programming language. When you make a new release we expect to find it there.
Please don't forget to include it when you make a new one.
Original issue reported on code.google.com by [email protected]
on 27 Oct 2013 at 5:19
Features:
* Port to Python 3
* Return all weather data from google about a specific country
* Return all weather data from yahoo about a specific country (experimental)
* Convert wind direction from degrees to a direction like N, S, E, W and
combinations
* Convert wind scale from km_per_hour to beaufort.
Original issue reported on code.google.com by [email protected]
on 17 Sep 2010 at 12:20
Attachments:
Currently, pywapi uses eval() to parse the json response from Yahoo's YQL
service, which is unsafe. The relevant code should be changed to use the
simplejson module instead.
Original issue reported on code.google.com by [email protected]
on 30 May 2013 at 3:31
It's a pretty easy fix to add the visibility field to data_structure tuple.
@@ -559,6 +559,7 @@
'windchill_string',
'windchill_f',
'windchill_c',
+ 'visibility_mi'
'icon_url_base',
'icon_url_name',
'two_day_history_url',
@@ -578,7 +579,7 @@
Original issue reported on code.google.com by [email protected]
on 16 Sep 2013 at 6:24
What steps will reproduce the problem?
1. Call pywapi.get_weather_from_yahoo('CAXX1978')
What is the expected output? What do you see instead?
Expect correctly-parsed weather data to be returned. Instead, pywapi crashes
with traceback:
File "/usr/lib/python2.7/dist-packages/pywapi.py", line 317, in
get_weather_from_yahoo
weather_data['geo']['lat'] = dom.getElementsByTagName('geo:lat')[0].firstChild.data
AttributeError: 'NoneType' object has no attribute 'data'
This has been fixed as of 0.3.1, reporting here for posterity.
Original issue reported on code.google.com by [email protected]
on 24 May 2013 at 6:41
Please support openweathermap.org
Python 2
import ast
import urllib2
weather =
ast.literal_eval(urllib2.urlopen('http://api.openweathermap.org/data/2.5/weather
?q=Paris,fr&units=metric').read())
Python 3
import ast
import urllib.request
weather =
ast.literal_eval(urllib.request.urllopen('http://api.openweathermap.org/data/2.5
/weather?q=Paris,fr&units=metric').read())
For all services to support, see http://openweathermap.org/api
Original issue reported on code.google.com by [email protected]
on 15 Dec 2014 at 1:00
You mention in the readme that to lookup a station id we should
"Other way to get the station ID: use this library:
http://code.google.com/p/python-weather/ and Weather.location2station function."
That code is now broken because Google has removed the old geo API it was based
on.
Original issue reported on code.google.com by [email protected]
on 13 Sep 2013 at 9:52
What steps will reproduce the problem?
Make an api call to weather.com, such as this:
weathercom = pywapi.get_weather_from_weather_com('94117')
pprint.pprint(weathercom['forecasts'][0])
What is the expected output? What do you see instead?
This correctly shows the next available forecast, however the date, and the day
of the week do not match. For example, today is Sunday, June 22nd. The returned
data set looks like this:
{'date': u'Jun 23',
'day': {'brief_text': u'',
'chance_precip': u'0',
'humidity': u'0',
'icon': u'',
'text': u'',
'wind': {'direction': u'0',
'gust': u'N/A',
'speed': u'calm',
'text': u'CALM'}},
'day_of_week': u'Sunday',
'high': u'12',
'low': u'11',
'night': {'brief_text': u'P Cloudy',
'chance_precip': u'10',
'humidity': u'90',
'icon': u'29',
'text': u'Partly Cloudy',
'wind': {'direction': u'255',
'gust': u'N/A',
'speed': u'20',
'text': u'WSW'}},
'sunrise': u'5:49 AM',
'sunset': u'8:35 PM'}
Note how the forecast is for tomorrow, June 23rd, 2014, but the day of the week
is listed as Sunday. These do not match. June 23rd is a Monday. I don't know if
I should believe the day of the week, or the date.
What version of the product are you using? On what operating system?
v0.3.8 on Debian Linux. Python version 2.7
Original issue reported on code.google.com by JeremyEBlum
on 23 Jun 2014 at 5:32
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.