Skip to content

Commit 769a2a4

Browse files
csparpaeumiroHarmon758jwmelvinWesley-Vos
authored
Version 3.1 (#342)
* backport from master branch * typo * Add disclaimer about newer API keys getting Authorization errors back when calling OWM legacy endpoints * Add timezone to all datetime objects and fix ISO format of time zone offset. * switched place * minor fixes * more tests for timestamps offset awareness. update docs * unused import * Documentation fixes (#323) * Fix documentation for accepted values for Weather.wind unit parameter * Add missing single quotation marks in documentation for Weather methods * Update reference link for OWM weather codes and icons * Add One Call functionaly: (1) exclude parts and (2) set desired units * Adding contributors from latest PRs * fixes #324 * Add an FAQ documentation section to help people fixing common issues on PyOWM (which recently occur as repeated GitHub issues) * added documentation to the code recipies; included unit test result * adding results of tox unit tests and integration tests * Update tox_integration_20200807.txt * Update and fix errors * Adding Ankur to contributors * Delete tox_20200807.txt * Delete tox_integration_20200807.txt * more FAQs * Added size argument weatherapi25.weather.weather_icon_url (#337) * Added size argument to weatherapi25.weather.weather_icon_url() * Fixed unit tests for new OWM icons * Fixed previous pushed unit test * Add Wesley-Vos * Exposed list of OWM supported languages * Removed dependency version pinning, this should fix #334 * forgot * This should address #332 * Documented workaround to install from the development branch, as stated in #341 (comment) and #318 * update docs (fixed typos) * documentation improvements * version dump * fixed test Co-authored-by: Miroslav Šedivý <[email protected]> Co-authored-by: Harmon <[email protected]> Co-authored-by: jwmelvin <[email protected]> Co-authored-by: Wesley Vos <[email protected]>
1 parent e35446e commit 769a2a4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1185
-518
lines changed

CONTRIBUTORS.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,32 @@ Contributors will be shown in alphabetical order
66
Code
77
----
88
* [alechewitt](https://github.com/alechewitt)
9+
* [camponez](https://github.com/camponez)
10+
* [dev-iks](https://github.com/dev-iks)
911
* [dphildebrandt](https://github.com/dphildebrandt)
1012
* [dstmar](https://github.com/dstmar)
1113
* [edenhaus](https://github.com/edenhaus)
14+
* [eumiro](https://github.com/eumiro)
1215
* [ggstuart](https://github.com/ggstuart)
16+
* [jwmelvin](https://github.com/jwmelvin)
1317
* [lardconcepts](https://github.com/lardconcepts)
1418
* [liato](https://github.com/liato)
1519
* [LukasBoersma](https://github.com/LukasBoersma)
20+
* [Misiu](https://github.com/Misiu)
1621
* [Noid](https://github.com/n0id)
1722
* [titilambert](https://github.com/titilambert)
1823
* [txemi](https://github.com/txemi)
19-
* [camponez](https://github.com/camponez)
20-
* [dev-iks](https://github.com/dev-iks)
24+
25+
* [Wesley-Vos](https://github.com/Wesley-Vos)
2126

2227
Docs
2328
----
2429
* [EJEP](https://github.com/EJEP)
30+
* [Harmon758](https://github.com/Harmon758)
2531

2632
Testing
2733
-------
34+
* [Ankur](https://github.com/Ankuraxz)
2835
* [Samuel Yap](https://github.com/samuelyap)
2936
* [Patrick Casbon](https://github.com/patcas)
3037
* [Tamas Magyar](https://github.com/tamasmagyar)
@@ -42,4 +49,4 @@ Wiki
4249

4350
Logo
4451
----
45-
* [marlinmm](https://github.com/marlinmm)
52+
* [marlinmm](https://github.com/marlinmm)

Pipfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ coverage = "*"
88
coveralls = "*"
99
Jinja2 = "*"
1010
pip = ">=18.0"
11-
pproxy = "==2.2.0"
11+
pproxy = ">=2.2.0,<3"
1212
pytest = "*"
1313
recommonmark = "*"
1414
Sphinx = "*"
15-
sphinx-readable-theme = ""==1.3.0"
15+
sphinx-readable-theme = "*"
1616
tox = "*"
1717
tox-travis = "*"
1818
virtualenv = "*"
1919
twine = "*"
2020

2121

2222
[packages]
23-
requests = "<3,==2.20.0"
24-
geojson = "<3,==2.3.0"
25-
PySocks = "<2,==1.7.1"
26-
requests[socks] = "*"
23+
requests = "<3,>=2.20.0"
24+
geojson = "<3,>=2.3.0"
25+
PySocks = "<2,>=1.7.1"
26+
"requests[socks]" = "*"

Pipfile.lock

Lines changed: 462 additions & 66 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ PyOWM runs on Python 3.7+
2222

2323
**Former Dark Sky API users**: you can can use PyOWM to get [OpenWeatherMap's OneCall API](https://openweathermap.org/api/one-call-api) data as an easy replacement to Dark Sky
2424

25-
### What kind of data do I get with PyOWM ?
25+
### What kind of data can I get with PyOWM ?
2626
With PyOWM you can integrate into your code any of the following OpenWeatherMap web APIs:
2727

2828
- **Weather API v2.5** + **OneCall API**, providing current weather data, weather forecasts, weather history
@@ -47,38 +47,39 @@ With a free OWM API Key:
4747

4848
```python
4949
from pyowm import OWM
50+
from pyowm.utils import config
51+
from pyowm.utils import timestamps
5052

51-
owm = OWM('your-API-key') # You MUST provide a valid API key
53+
# ---------- FREE API KEY examples ---------------------
5254

53-
# Search for current weather in London (Great Britain)
55+
owm = OWM('your free OWM API key')
5456
mgr = owm.weather_manager()
57+
58+
59+
# Search for current weather in London (Great Britain) and get details
5560
observation = mgr.weather_at_place('London,GB')
5661
w = observation.weather
57-
print(w) # <Weather - reference time=2013-12-18 09:20, status=Clouds>
5862

59-
# Weather details
63+
w.detailed_status # 'clouds'
6064
w.wind() # {'speed': 4.6, 'deg': 330}
6165
w.humidity # 87
6266
w.temperature('celsius') # {'temp_max': 10.5, 'temp': 9.7, 'temp_min': 9.0}
67+
w.rain # {}
68+
w.heat_index # None
69+
w.clouds # 75
6370

64-
# Search current weather observations in the surroundings of
65-
# lat=22.57W, lon=43.12S (Rio de Janeiro, BR)
66-
observation_list = mgr.weather_around_coords(-22.57, -43.12)
67-
```
71+
# Will it be clear tomorrow at this time in Milan (Italy) ?
72+
forecast = mgr.forecast_at_place('Milan,IT', 'daily')
73+
answer = forecast.will_be_clear_at(timestamps.tomorrow())
6874

69-
With a paid OWM API key:
75+
# ---------- PAID API KEY example ---------------------
7076

71-
```python
72-
from pyowm.owm import OWM
73-
from pyowm.utils import config
74-
from pyowm.utils import timestamps
7577
config_dict = config.get_default_config_for_subscription_type('professional')
76-
owm = OWM('your-paid-api-key', config_dict)
78+
owm = OWM('your paid OWM API key', config_dict)
7779

78-
# Will it be clear tomorrow at this time in Milan (Italy) ?
79-
mgr = owm.weather_manager()
80-
forecast = mgr.forecast_at_place('Milan,IT', 'daily')
81-
forecast.will_be_clear_at(timestamps.tomorrow()) # The sun always shines on Italy, right? ;)
80+
# What's the current humidity in Berlin (Germany) ?
81+
one_call_object = mgr.one_call(lat=52.5244, lon=13.4105)
82+
one_call_object.current.humidity
8283
```
8384

8485

@@ -92,18 +93,24 @@ $ pip install pyowm
9293
There are alternatives: _setuptools_, _Windows installers_ and common Linux package managers such as _Yaourt (Arch Linux)_
9394
_YaST/Zypper (OpenSuse)_ (please refer to the documentation for more detail)
9495

95-
Eager to fetch the very latest updates to PyOWM? Install the development trunk (which might be unstable):
96+
Eager to fetch the very latest updates to PyOWM? Install the development trunk (which might be unstable). Eg on Linux:
9697

9798
```shell
98-
$ pip install git+https://github.com/csparpa/pyowm.git@develop
99+
$ git clone https://github.com/csparpa/pyowm.git
100+
$ cd pyowm && git checkout develop
101+
$ pip install -r requirements.txt && python setup.py install
99102
```
100103

101104
## Documentation
102105
The library software API documentation is available on [Read the Docs](https://pyowm.readthedocs.io/en/latest/).
103106

104-
Each release has its own [changelog](https://github.com/csparpa/pyowm/wiki/Changelog).
107+
The [Code recipes](https://pyowm.readthedocs.io/en/latest/v3/code-recipes.html) section comes in handy!
108+
105109

110+
## Help - PyOWM is giving me errors!
111+
Please read the [FAQ](https://pyowm.readthedocs.io/en/latest/v3/faq.html) section of the documentation before filing a new issue on GitHub!
106112

113+
There are many common issues, therefore a fix for your issue might come easier than you think
107114

108115
## Community & Contributing
109116

dev-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ coverage
22
coveralls
33
Jinja2
44
pip>=18.0
5-
pproxy<3
5+
pproxy>=2.2.0,<3
66
pytest
77
recommonmark
88
Sphinx

pyowm/airpollutionapi30/coindex.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def reference_time(self, timeformat='unix'):
5050
5151
:param timeformat: the format for the time value. May be:
5252
'*unix*' (default) for UNIX time
53-
'*iso*' for ISO8601-formatted string in the format ``YYYY-MM-DD HH:MM:SS+00``
53+
'*iso*' for ISO8601-formatted string in the format ``YYYY-MM-DD HH:MM:SS+00:00``
5454
'*date* for ``datetime.datetime`` object instance
5555
:type timeformat: str
5656
:returns: an int or a str
@@ -66,7 +66,7 @@ def reception_time(self, timeformat='unix'):
6666
6767
:param timeformat: the format for the time value. May be:
6868
'*unix*' (default) for UNIX time
69-
'*iso*' for ISO8601-formatted string in the format ``YYYY-MM-DD HH:MM:SS+00``
69+
'*iso*' for ISO8601-formatted string in the format ``YYYY-MM-DD HH:MM:SS+00:00``
7070
'*date* for ``datetime.datetime`` object instance
7171
:type timeformat: str
7272
:returns: an int or a str
@@ -114,7 +114,7 @@ def from_dict(cls, the_dict):
114114
raise exceptions.ParseAPIResponseError('Data is None')
115115
try:
116116
# -- reference time (strip away Z and T on ISO8601 format)
117-
t = the_dict['time'].replace('Z', '+00').replace('T', ' ')
117+
t = the_dict['time'].replace('Z', '+00:00').replace('T', ' ')
118118
reference_time = formatting.ISO8601_to_UNIXtime(t)
119119

120120
# -- reception time (now)

pyowm/airpollutionapi30/no2index.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def reference_time(self, timeformat='unix'):
5050
5151
:param timeformat: the format for the time value. May be:
5252
'*unix*' (default) for UNIX time
53-
'*iso*' for ISO8601-formatted string in the format ``YYYY-MM-DD HH:MM:SS+00``
53+
'*iso*' for ISO8601-formatted string in the format ``YYYY-MM-DD HH:MM:SS+00:00``
5454
'*date* for ``datetime.datetime`` object instance
5555
:type timeformat: str
5656
:returns: an int or a str
@@ -66,7 +66,7 @@ def reception_time(self, timeformat='unix'):
6666
6767
:param timeformat: the format for the time value. May be:
6868
'*unix*' (default) for UNIX time
69-
'*iso*' for ISO8601-formatted string in the format ``YYYY-MM-DD HH:MM:SS+00``
69+
'*iso*' for ISO8601-formatted string in the format ``YYYY-MM-DD HH:MM:SS+00:00``
7070
'*date* for ``datetime.datetime`` object instance
7171
:type timeformat: str
7272
:returns: an int or a str
@@ -114,7 +114,7 @@ def from_dict(cls, the_dict):
114114
raise exceptions.ParseAPIResponseError('Data is None')
115115
try:
116116
# -- reference time (strip away Z and T on ISO8601 format)
117-
t = the_dict['time'].replace('Z', '+00').replace('T', ' ')
117+
t = the_dict['time'].replace('Z', '+00:00').replace('T', ' ')
118118
reference_time = formatting.ISO8601_to_UNIXtime(t)
119119

120120
# -- reception time (now)

pyowm/airpollutionapi30/ozone.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def reference_time(self, timeformat='unix'):
4848
4949
:param timeformat: the format for the time value. May be:
5050
'*unix*' (default) for UNIX time
51-
'*iso*' for ISO8601-formatted string in the format ``YYYY-MM-DD HH:MM:SS+00``
51+
'*iso*' for ISO8601-formatted string in the format ``YYYY-MM-DD HH:MM:SS+00:00``
5252
'*date* for ``datetime.datetime`` object instance
5353
:type timeformat: str
5454
:returns: an int or a str
@@ -64,7 +64,7 @@ def reception_time(self, timeformat='unix'):
6464
6565
:param timeformat: the format for the time value. May be:
6666
'*unix*' (default) for UNIX time
67-
'*iso*' for ISO8601-formatted string in the format ``YYYY-MM-DD HH:MM:SS+00``
67+
'*iso*' for ISO8601-formatted string in the format ``YYYY-MM-DD HH:MM:SS+00:00``
6868
'*date* for ``datetime.datetime`` object instance
6969
:type timeformat: str
7070
:returns: an int or a str
@@ -98,7 +98,7 @@ def from_dict(cls, the_dict):
9898
raise exceptions.ParseAPIResponseError('Data is None')
9999
try:
100100
# -- reference time (strip away Z and T on ISO8601 format)
101-
ref_t = the_dict['time'].replace('Z', '+00').replace('T', ' ')
101+
ref_t = the_dict['time'].replace('Z', '+00:00').replace('T', ' ')
102102
reference_time = formatting.ISO8601_to_UNIXtime(ref_t)
103103

104104
# -- reception time (now)

pyowm/airpollutionapi30/so2index.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def reference_time(self, timeformat='unix'):
4949
5050
:param timeformat: the format for the time value. May be:
5151
'*unix*' (default) for UNIX time
52-
'*iso*' for ISO8601-formatted string in the format ``YYYY-MM-DD HH:MM:SS+00``
52+
'*iso*' for ISO8601-formatted string in the format ``YYYY-MM-DD HH:MM:SS+00:00``
5353
'*date* for ``datetime.datetime`` object instance
5454
:type timeformat: str
5555
:returns: an int or a str
@@ -65,7 +65,7 @@ def reception_time(self, timeformat='unix'):
6565
6666
:param timeformat: the format for the time value. May be:
6767
'*unix*' (default) for UNIX time
68-
'*iso*' for ISO8601-formatted string in the format ``YYYY-MM-DD HH:MM:SS+00``
68+
'*iso*' for ISO8601-formatted string in the format ``YYYY-MM-DD HH:MM:SS+00:00``
6969
'*date* for ``datetime.datetime`` object instance
7070
:type timeformat: str
7171
:returns: an int or a str
@@ -99,7 +99,7 @@ def from_dict(cls, the_dict):
9999
raise exceptions.ParseAPIResponseError('Data is None')
100100
try:
101101
# -- reference time (strip away Z and T on ISO8601 format)
102-
t = the_dict['time'].replace('Z', '+00').replace('T', ' ')
102+
t = the_dict['time'].replace('Z', '+00:00').replace('T', ' ')
103103
reference_time = formatting.ISO8601_to_UNIXtime(t)
104104

105105
# -- reception time (now)

pyowm/alertapi30/alert.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def from_dict(cls, the_dict):
8181
raise exceptions.ParseAPIResponseError('Data is None')
8282
try:
8383
alert_id = the_dict['_id']
84-
t = the_dict['last_update'].split('.')[0].replace('T', ' ') + '+00'
84+
t = the_dict['last_update'].split('.')[0].replace('T', ' ') + '+00:00'
8585
alert_last_update = formatting.ISO8601_to_UNIXtime(t)
8686
alert_trigger_id = the_dict['triggerId']
8787
alert_met_conds = [

0 commit comments

Comments
 (0)