Skip to content

Commit 0a0f343

Browse files
committed
[Minor] Add a warning message when running on window and USERNAME is set
1 parent fd0f327 commit 0a0f343

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

README.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,4 @@ Once installed you can simple add lnetatmo to your python scripts by including:
2222

2323
import lnetatmo
2424

25-
**New features** (see usage for details)
26-
27-
cameras (Welcome and Presence) :
28-
- get live jpeg snapshot with `homeData.getLiveSnapshot(camera="{name}")`
29-
- get best access url (local if possible else vpn) with `homeData.url(camera="{name}")` and it works despite the is_local property of the camera being mostly false (the camera IP is catched only on camera start and never updated even if the home IP change)
30-
31-
Presence : switch camera on or off with `homeData.presenceStatus("on|off", camera="{name}")`
25+
For documentation, see usage

lnetatmo.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# Published Jan 2013
2-
# Revised Jan 2014 (to add new modules data)
3-
# Revised 2016 (to add camera support)
42
# Author : Philippe Larduinat, ph.larduinat@wanadoo.fr
53
# Multiple contributors : see https://github.com/philippelt/netatmo-api-python
64
# License : GPL V3
@@ -15,6 +13,8 @@
1513
from sys import version_info
1614
from os import getenv
1715
from os.path import expanduser, exists
16+
import platform
17+
import warnings
1818
import json, time
1919
import imghdr
2020
import warnings
@@ -30,6 +30,7 @@
3030
from urllib import urlencode
3131
import urllib2
3232

33+
3334
######################## AUTHENTICATION INFORMATION ######################
3435

3536
# To be able to have a program accessing your netatmo data, you have to register your program as
@@ -69,6 +70,13 @@ def getParameter(key, default):
6970
cred.update({k.upper():v for k,v in json.loads(f.read()).items()})
7071

7172
# 3 : Override final value with content of env variables if defined
73+
# Warning, for Windows user, USERNAME contains by default the windows logged user name
74+
# This usually lead to an authentication error
75+
if platform.system() == "Windows" and getenv("USERNAME", None):
76+
warnings.warn("You are running on Windows and the USERNAME env var is set. " \
77+
"Be sure this env var contains Your Netatmo username " \
78+
"or clear it with <SET USERNAME=> before running your program\n", RuntimeWarning, stacklevel=3)
79+
7280
_CLIENT_ID = getParameter("CLIENT_ID", cred)
7381
_CLIENT_SECRET = getParameter("CLIENT_SECRET", cred)
7482
_USERNAME = getParameter("USERNAME", cred)

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
setup(
66
name='lnetatmo',
7-
version='1.6.1',
7+
version='1.6.2',
88
classifiers=[
99
'Development Status :: 5 - Production/Stable',
1010
'Intended Audience :: Developers',
@@ -17,7 +17,7 @@
1717
scripts=[],
1818
data_files=[],
1919
url='https://github.com/philippelt/netatmo-api-python',
20-
download_url='https://github.com/philippelt/netatmo-api-python/tarball/v1.6.1.tar.gz',
20+
download_url='https://github.com/philippelt/netatmo-api-python/tarball/v1.6.2.tar.gz',
2121
license='GPL V3',
2222
description='Simple API to access Netatmo weather station data from any python script.'
2323
)

0 commit comments

Comments
 (0)