# distro-4648-interm-sr-delivery

This script serves as an intermediate solution to re-compile sound recordings and deliver them to facebook. The input is a file on S3 that contains product UPCs.

### Setup

Set proper python version.
```
$ pyenv local
```

Create virtual environment
```
$ python -m venv env
$ source env/bin/activate
```

Install Packages
```
(env) $ pip install -r requirements.txt
```

### Execute

Run in virtual environment
```
(env) $ export ENVIRONMENT=qa && python app.py
```

Additional params
```
usage: app.py [-h] [--dir {ready,processing,complete}] [--filename FILENAME] [--since SINCE] [--throttle THROTTLE] [--backoff BACKOFF] [--retries RETRIES]

optional arguments:
  -h, --help            show this help message and exit
  --dir {ready,processing,complete}
                        Sub directory to look for files in (default: ready)
  --filename FILENAME   Specific file to process, default to oldest in sub dir (default: None)
  --since SINCE         UPC to start processing from (default: None)
  --throttle THROTTLE   Max running delivery SFNs (default: 10)
  --backoff BACKOFF     Time in seconds to sleep on error (default: 180)
  --retries RETRIES     Max number of times to retry errors (default: 5)
```
