Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot login #13

Open
solvek opened this issue Dec 9, 2022 · 10 comments
Open

Cannot login #13

solvek opened this issue Dec 9, 2022 · 10 comments

Comments

@solvek
Copy link

solvek commented Dec 9, 2022

The installed version is 0.6
Trying commmand line from the example:

!micloud -d -u '<Email Login>' --country 'cn' --pretty
The output:
Error: no such option: -u

The code:

from micloud import MiCloud

mc = MiCloud("<Email>", "<Password>")
mc.login() # Returns false
token = mc.get_token() # Retruns None
device_list = mc.get_devices(country="cn")

The most recent command returns such error:
ERROR:root:Cannot execute request. service token or userId missing. Make sure to login.

Just for information: I am running the code in Google Colab

@solvek
Copy link
Author

solvek commented Dec 9, 2022

Basically what I eventually need to achive just for my each device get information whether it is currently online (or when it was online recently) from my python script. Is it possible?

@Squachen
Copy link
Owner

Squachen commented Dec 9, 2022

Version 0.6 changed how the cli works and I've forgotten to update the documentation.
Now you have to specify what command you want to run:

Usage: micloud [OPTIONS] COMMAND [ARGS]...

  Tool for fetching xiaomi cloud information.

Options:
  -d, --debug
  --help       Show this message and exit.

Commands:
  get-devices  Get device information, including tokens.
  miot         Commands for miotspec fetching.

Your example would be:

micloud get-devices -u <email> --pretty

or if you want the debug output:

micloud -d get-devices -u <email>

I'll update the documentation asap.

@solvek
Copy link
Author

solvek commented Dec 9, 2022

Thanks. Tried this command
micloud get-devices

It asked for username then password. I provided both but then received error:
Error: Got unexpected extra argument (get-devices)

@Squachen
Copy link
Owner

Squachen commented Dec 9, 2022

I cannot reproduce that error running Python 3.11.0 and micloud 0.6 installed by pip.

@solvek
Copy link
Author

solvek commented Dec 9, 2022

What basically is username for xiaomi? Will email work?

@Squachen
Copy link
Owner

Squachen commented Dec 9, 2022

Yes email should work. Also check if you are effected by issue #6
edit: wrong issue link

@solvek
Copy link
Author

solvek commented Dec 9, 2022

It seems on the login step 2 server returned unexpected json content.

{
   "notificationUrl":"https://account.xiaomi.com/identity/authStart?...&_locale=en_US",
   "result":"ok",
   "code":0,
   "captchaUrl":null,
   "description":"\u6210\u529f",
   "location":"",
   "securityStatus":16,
   "pwd":0,
   "child":0,
   "desc":"\u6210\u529f"
}

But it expects to have json attributes userId, ssecurity and so on.

@Squachen
Copy link
Owner

Squachen commented Dec 9, 2022

Seems to be a similar problem, did you try going to the "notificationUrl" in a browser as described in issue #6 ?

@solvek
Copy link
Author

solvek commented Dec 9, 2022

Seems to be a similar problem, did you try going to the "notificationUrl" in a browser as described in issue #6 ?

Yes, but the content in the page is different.
image

I do verification and getting "ok" on web page but still login from python code does not work for me.

@spicydonkey
Copy link

I'm having the same problem as @solvek described. Completing the two factor authentification by following the url back steps in #6 didn't help. Specifically, when I run micloud again to login, it returns to the same situation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants