Skip to main content

A CLI for fetching past orders from Swiggy and performing basic stats in the terminal

Project description

# swiggy-analytics

[![version](https://img.shields.io/pypi/v/swiggy-analytics.svg)](https://pypi.org/project/swiggy-analytics/) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/mr-karan/fate/master/LICENSE)

![Overview image](images/overview.png)

swiggy-analytics is CLI for fetching past orders from Swiggy and storing them in a local SQLLite DB. It also displays basic stats on your order history in the terminal, such as your most frequently order dish, your monthly expenditure, weekday wise distribution of orders and much more. For more advanced users, who wish to perform their own analysis, can do so by using the sqlite3 db file which is generated.

_NOTE_: Only supported by Python3. Seriously, if you’re still using Python2, _please_ [STOP](https://pythonclock.org/). I’ve tested it on Python3.5+ on OSX and Ubuntu 18.04 Vagrant machine.

## Important Disclaimer

This tool needs to login to your Swiggy account and fetch the order history. The account username lives on your local file system. If you don’t feel comfortable entering these details, you can audit the code yourself to be sure that this information is not used in any evil way. There’s an OTP which is sent to your registered mobile number, which is required everytime you fetch orders. Cheers!

## Getting Started

### Installation

pip install swiggy-analytics

### Setting up account

If you run swiggy-analytics for the first time, it will prompt you for your registered mobile number. An OTP will be sent to your phone and after the session is authenticated, a file .swiggy-analytics-config.ini is created in your home directory. The file contains your username to your Swiggy account, so you don’t have to re-enter this detail everytime you run the tool.

![](images/configure-otp.png)

You can also regenrate your config file by explictly passing the flag with the command executable, such as: swiggy-analytics –configure

NOTE: Username is your phone number which you have registered with your Swiggy account.

### Quickstart

`sh swiggy-analytics --save `

![fetch](images/swiggy-analytics-fetch.gif)

  • If you want to persist the orders data to a local database, you should use the –save flag. This option would generate a swiggy.db file in your current working directory.

  • In case you just want to run it once and see basic stats, you can skip this flag and the tool will hold the data in an in memory DB which would last only till the program is running.

## Advanced

You can write your own SQL queries by importing swiggy.db in your DB tool. I personally used Metabase and setup a dashboard with interesting charts presenting patterns on my ordering behaviour.

![metabase-1](images/metabase-1.png) ![metabase-2](images/metabase-2.png)

## Credits

## Contribution

PRs on Feature Requests, Bug fixes are welcome. Feel free to open an issue and have a discussion first.

## License

[MIT](license)

### Disclaimer

This tool is only intended for personal use and is a simple demonstration. It is in open domain and I am not responsible if you use it and violate any TnC. Or as they say, it’s for science.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

swiggy_analytics-1.7.0.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

swiggy_analytics-1.7.0-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file swiggy_analytics-1.7.0.tar.gz.

File metadata

  • Download URL: swiggy_analytics-1.7.0.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for swiggy_analytics-1.7.0.tar.gz
Algorithm Hash digest
SHA256 ed9ae3709df1f064359718169cef29ae69bb82a43a6014a37f428ffe9fb7b7a2
MD5 9d7ca32da65aa2261c9ff67f25837cfe
BLAKE2b-256 a3d0c17a56df8b8681f273208a18c7ad411f93bbaac08fd9491712ca251737ba

See more details on using hashes here.

File details

Details for the file swiggy_analytics-1.7.0-py3-none-any.whl.

File metadata

File hashes

Hashes for swiggy_analytics-1.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b235173009266f44b5e01458559936508ae6e3adcd50502b23b78191cfe14651
MD5 d6398ecc2522f44319fc29a8bef691db
BLAKE2b-256 7875fae135b14d1478dd85aab5bd795a3ebe92c6aca485cda64c98a340718a15

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page