Skip to content

edghyhdz/migros_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Unofficial Migros API

An unofficial Migros API (more like Cumulus API) to fetch cumulus and receipt data, as well as receipt PDFs!

Description

This script uses python requests to authenticate to the official Migros website. Once authenticated via password and username, you can further authenticate with your cumulus account.

You can see a brief showcase of how it can be used either on the video below, or in the description that follows.

screenshot

Usage

  1. git clone this repository
  2. Once inside the root directory where you cloned this repo,
from api.migros_api import MigrosApi
from datetime import datetime, timedelta
from getpass import getpass

pwd = getpass("yourpassword": )
email = "[email protected]"  # Username of your migros account

migros_api = MigrosApi(pwd, email)
  1. Once authenticated, it will let you know whether it was successful or not
  • If it was successful, then you can proceed to authenticate to your cumulus account like so
migros_api.login_cumulus()
  • Where if successful, you should see the loggin message stating so.
  1. Once authenticated, you can use the following methods,
migros_api.get_all_kasenbons(period_from: datetime, period_to: datetime)
  • This method will get all receipts from a given period of time, indicated by the period_from and period_to parameters
  • This will return a tuple, containing a dictionary with all requested receipts, plus the raw data
  1. You can retrieve a specific receipt with the method get_kassenbon() like so,
receipt = migros_api.get_kassenbon(receipt_id: str)
type(receipt) -> ReceiptItem
  • This will return a ReceiptItem, that itself has the following methods,
receipt.get_raw_data()  
  • Gets all raw data from requested receipt
receipt.get_data_frame()  
  • Parses receipt data into dataframe
receipt.to_pdf(path: str)  
  • Saving receipt as pdf to the given path folder

About

Unofficial Migros API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages