Comments (6)
We should probably deprecate that option (throw deprecation warning when True), keep it that way like ~2 versions and then drop it completely... that means remove condition on line:
I bet that no one is using login_on_demand=True anyway (my code is also not using it)...
from huawei-lte-api.
Looking for a replacement for (what I assume) on demand was doing. My script runs 24h and checks lte status on router - when it's bad then forces reconnect with set_mobile_dataswitch or does reboot. Now I'm getting exception with "100003: No rights (needs login)" message after each 5 minutes.
So, is timeout in AuthorizedConnection used for anything? I would assume that it relogs in when something is executed after timeout passes but enforce_authorized_connection() is not called anywhere. It is supposed to be manually called?
Edit: based on https://github.com/home-assistant/core/blob/dev/homeassistant/components/huawei_lte/__init__.py#L193 it is supposed to be called manually.
from huawei-lte-api.
@arekm well there is RFC PR #96 with changes to handle all this but it needs some polishing and i don't have time right now, i will try to look at it next weeek...
from huawei-lte-api.
Ok. Just a note that
AuthorizedConnection()
Client()
try:
dosomething
except ResponseErrorLoginRequiredException:
connection.enforce_authorized_connection()
doesn't relog us in if router is rebooted (in middle of "dosomething", even with just client.device.reboot()) and thus we aren't logged in anymore. enforce_authorized_connection() has no knowledge if we are actually logged in in router (only knows if API thinks we are logged in).
So the only safe thing to do as client is to:
except ResponseErrorLoginRequiredException:
# full connection again
AuthorizedConnection()
Client()
I don't see "logout" in API, so ugly
except ResponseErrorLoginRequiredException:
auth_conn.logged_in = False
connection.enforce_authorized_connection()
would also work.
from huawei-lte-api.
@arekm 1.5 is out with context manager and option to close session...
so you can do
with Connection('url') as connection:
client = Client(connection)
# Do stuff
# auto logout & close session
or
connection = Connection('url')
client = Client(connection)
# Do stuff
connection.close() # manually logout & close session
Let me know if this release solves your issues....
from huawei-lte-api.
And login_on_demand has been deprecated and has no effect, it will be removed in next major release, so closing this for now
from huawei-lte-api.
Related Issues (20)
- ResponseErrorException: 100006 for hardware CL2E3372HM HOT 8
- Reboot script HOT 1
- Switch Wifi on/off HOT 3
- Exception on log-out ResponseErrorWrongSessionToken: 125003: Wrong Session Token HOT 3
- Issues with multi-part SMS messages (Type 2) HOT 9
- Disabling automatic online updates HOT 3
- Quicksetup HOT 5
- Disabling IPv6 HOT 2
- Can't connect to my modem HOT 4
- Unable to connect to Huawei B535-333 with the error 125003 (Wrong token)
- Toggle VPN status HOT 7
- Can't enable telnet on device HOT 1
- Huawei E8231 also work HOT 1
- Error: 113004 HOT 1
- I ran the example but didn't work HOT 6
- Ping example?
- ussd request example HOT 6
- Accessing device remotely HOT 2
- How to make a basic mac filter ? HOT 10
- E3372 CL1E3372SM Ver.A api doesn't work HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from huawei-lte-api.