mr-karan/swiggy-analytics

fails after entering phone number

garrykevin-ep opened this issue · 5 comments

Connecting to /Users/gkevin/Library/Python/3.9/bin/swiggy.db
Traceback (most recent call last):
  File "/Users/gkevin/Library/Python/3.9/bin/swiggy-analytics", line 8, in <module>
    sys.exit(main())
  File "/Users/gkevin/Library/Python/3.9/lib/python/site-packages/swiggy_analytics/swiggy_analytics.py", line 72, in main
    perform_login()
  File "/Users/gkevin/Library/Python/3.9/lib/python/site-packages/swiggy_analytics/helper.py", line 116, in perform_login
    csrf_token = establish_connection.text.split("csrfToken")[1].split("=")[
IndexError: list index out of rang
``1

same issue

Still getting the same error:

C:\Users\XX>swiggy-analytics --save
Welcome to swiggy-analytics.

This command line tool will help you fetch your order history from https://swiggy.com.
You can choose to persist the detailed order information in a SQLite database or
perform lightweight stats operations using in-memory calculations.

Connecting to C:\Users\XX\swiggy.db
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "C:\Users\XX\AppData\Local\Programs\Python\Python311\Scripts\swiggy-analytics.exe_main
.py", line 7, in
File "C:\Users\XX\AppData\Local\Programs\Python\Python311\Lib\site-packages\swiggy_analytics\swiggy_analytics.py", line 72, in main
perform_login()
File "C:\Users\XX\AppData\Local\Programs\Python\Python311\Lib\site-packages\swiggy_analytics\helper.py", line 116, in perform_login
csrf_token = establish_connection.text.split("csrfToken")[1].split("=")[
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range

@mr-karan Karan, any luck with this issue?

Faced the same issue. But I am able to run if I build from the source locally and install it, instead of the package published on PyPi.

@mr-karan I think the issue is with user-agent, if a user-agent is not provided swiggy is returning a standard error page which says "We are fixing a temporary glitch. Sorry for the inconvenience." without a csrf-token.
The last PyPi release was on Apr 28, 2019 and doesn't have the commit 5802382 which adds user-agent header in all the requests. Hence it's working when installed from a local build and not from PyPi. Will you be able to push a new release to PyPi?

This should be fine now with the latest release