shmick / pcexpress-pickup

A script to check for available pickup times at PC Express locations

Home Page:https://hub.docker.com/r/shmick/pcexpress-pickup

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pcexpress-pickup

A script to check for available pickup times at PC Express locations

Usage

$ python check_all_by_postal_code.py
usage: check_all_by_postal_code.py [-h] [-p P] [-lat LAT] [-long LONG] [-d D] [-r] [-id ID] [-brands BRANDS]

optional arguments:
  -h, --help         show this help message and exit
  -p P, -postal P    ex: m5w1e6
  -lat LAT           ex: 43.703344
  -long LONG         ex: -79.524619
  -d D, -distance D  Search distance in KM
  -r, -report        report lat + long and stores found within search distance. will not check available pickup times
  -id ID             comma seperated store IDs ex: 1111,1122
  -brands BRANDS     filter by comma seperated store brands ex: loblaw,superstore,zehrs

Report a list of stores available within a 10KM radius

$ python check_all_by_postal_code.py -p m5e1w6 -d 10 -r
For faster lookup times use: -lat 43.703344 -long -79.524619
superstore, id: 2800, 2549 Weston Rd Toronto, Ontario M9N 2A7, approx 0.9 KM away
<...>
fortinos, id: 0096, 3940 Hwy 7 RR 2 Vaughan, Ontario L4L 9C3, approx 9.8 KM away

Use -lat and -long to avoid doing a postal code lookup each time

$ python check_all_by_postal_code.py -lat 43.703344 -long -79.524619 -d 10 
9 available at nofrills at 245 Dixon Rd Etobicoke, Ontario M9P 2M4 approx 1.8 KM away
2020-04-14 09:00:00-04:00
<...>
2020-04-23 19:00:00-04:00

1 available at loblaw at 270 The Kingsway Etobicoke, Ontario M9A 3T7 approx 4.7 KM away
2020-04-23 16:00:00-04:00

1 available at loblaw at 3671 Dundas St W Toronto, Ontario M6S 2T3 approx 4.8 KM away
2020-04-23 16:00:00-04:00

Use -id to search for pickup times at specific stores. Geo lookup disaabled, so distance will always be 0 KM

$ python check_all_by_postal_code.py -id 2800,3480,1174
20 available at loblaw at 270 The Kingsway Etobicoke, Ontario M9A 3T7 approx 0 KM away
2020-04-14 14:00:00-04:00
<...>
2020-04-23 15:00:00-04:00

Installation using a python3 virtual environment - python 3.6 or newer required

$ git clone https://github.com/shmick/pcexpress-pickup
$ python3 -m venv pcexpress-pickup/
$ cd pcexpress-pickup/
$ source bin/activate
$ pip install -r requirements.txt 

Run via Docker

$ docker run shmick/pcexpress-pickup -lat 43.703344 -long -79.524619
8 available at nofrills at 245 Dixon Rd Etobicoke, Ontario M9P 2M4 approx 1.8 KM away
2020-04-23 12:00:00-04:00
<...>
2020-04-23 19:00:00-04:00

1 available at loblaw at 3671 Dundas St W Toronto, Ontario M6S 2T3 approx 4.8 KM away
2020-04-23 16:00:00-04:00

Build and run your own container

$ git clone https://github.com/shmick/pcexpress-pickup
$ cd pcexpress-pickup/
$ docker build -t pcexpress-pickup:latest .
$ docker run shmick/pcexpress-pickup

Notes

https://www.pcexpress.ca/bundle.js contains a list of all pcexpress pickup locations as well as plenty of other store and location metadata.

Active stores locations have been extracted to locations.json, which is what the utility uses.

The entire unfiltered location dataset has been saved to unfiltered-locations.json

location sample data

{
  "locations": [
    {
      "id": "0925",
      "contactNumber": "7096430850",
      "name": "Prince Rupert Street",
      "storeId": "0925",
      "storeBannerId": "dominion",
      "locationType": "STORE",
      "pickupType": "STORE",
      "bufferTimeInHours": 2,
      "partner": null,
      "visible": true,
      "isShoppable": true,
      "geoPoint": {
        "latitude": 48.546052,
        "longitude": -58.582397
      },
      "address": {
        "country": "Canada",
        "region": "Newfoundland and Labrador",
        "town": "Stephenville",
        "line1": "62 Prince Rupert St",
        "line2": null,
        "postalCode": "A2N 3W7",
        "formattedAddress": "62 Prince Rupert St Stephenville, Newfoundland and Labrador A2N 3W7"
      },
      "timeZone": "Canada/Newfoundland",
      "features": []
    },
    {
      "id": "0927",
      "contactNumber": "7096513437",
      "name": "Laurell Road",
      "storeId": "0927",
      "storeBannerId": "dominion",
      "locationType": "STORE",
      "pickupType": "STORE",
      "bufferTimeInHours": 2,
      "partner": null,
      "visible": true,
      "isShoppable": true,
      "geoPoint": {
        "latitude": 48.949657,
        "longitude": -54.60071
      },
      "address": {
        "country": "Canada",
        "region": "Newfoundland and Labrador",
        "town": "Gander",
        "line1": "100 Laurell Rd",
        "line2": null,
        "postalCode": "A1V 2V5",
        "formattedAddress": "100 Laurell Rd Gander, Newfoundland and Labrador A1V 2V5"
      },
      "timeZone": "Canada/Newfoundland",
      "features": []
    }
  ]
}

About

A script to check for available pickup times at PC Express locations

https://hub.docker.com/r/shmick/pcexpress-pickup

License:MIT License


Languages

Language:Python 96.8%Language:Dockerfile 1.7%Language:Shell 1.5%