lastpass-python icon indicating copy to clipboard operation
lastpass-python copied to clipboard

lastpass library suddenly stopped working

Open anton-hajdu opened this issue 5 years ago • 9 comments

Hi,

I am using lastpass-python in my projects, but today morning stopped working and I am unable get credentials from lastpass.

Looks like they changed something in lastpass ...

I tried this with more accounts, with more computers, within more networks...

Thanks

anton-hajdu avatar May 04 '21 08:05 anton-hajdu

Stopped working for me as well!

Mast3rSensei avatar May 04 '21 13:05 Mast3rSensei

https://lastpass.com/iterations.php is returning a 500 code

nineclicks avatar May 04 '21 16:05 nineclicks

https://lastpass.com/iterations.php is returning a 500 code

I can confirm. It works fine if you visit via a browser, but it's failing in the requests post here https://github.com/konomae/lastpass-python/blob/1ece13f04bb6c20ba1d01e7bcfcad6a48ee6527f/lastpass/fetcher.py#L51-L52

I've also tested a requests.get and still get a 500 status code.

Edit: Here's the kicker: I just tested using the ruby version of the repo and it works fine. Must be something with lastpass and requests, otherwise I can't figure out what's going on.

Edit2: The post works with urllib3, so it's apparently a requests specific issue

TillerBurr avatar May 04 '21 16:05 TillerBurr

I think adding Chrome headers to the two POST requests in fetcher.py fixed it.

    headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36'} # This is chrome, you can set whatever browser you like
    response = web_client.post('https://lastpass.com/iterations.php',
                               data={'email': username},
                               headers=headers

    headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36'} # This is chrome, you can set whatever browser you like
    response = web_client.post('https://lastpass.com/login.php',
                               data=body,
                               headers=headers)

nineclicks avatar May 04 '21 17:05 nineclicks

That worked for me. I noticed that the default user agent for requests is python-requests. For those routes, they must be strictly denied access, because the URL https://lastpass.com/ works perfectly fine.

TillerBurr avatar May 04 '21 18:05 TillerBurr

Works!

anton-hajdu avatar May 05 '21 05:05 anton-hajdu

Worked for me as well

raishahnawaz avatar May 05 '21 09:05 raishahnawaz

This worked for me too, @konomae, will you be pushing an update with this? Thanks!

xaelvil avatar May 05 '21 14:05 xaelvil

Thank you for reporting this!

This problem has been fixed:

  • https://github.com/konomae/lastpass-python/releases/tag/v0.3.2
  • https://pypi.org/project/lastpass-python/0.3.2/

Related:

  • #41
  • #42
  • https://github.com/konomae/lastpass-python/compare/v0.3.1...v0.3.2

konomae avatar May 08 '21 07:05 konomae