Skip to content

Commit

Permalink
fix: env var loading
Browse files Browse the repository at this point in the history
  • Loading branch information
MattTimms committed Jul 24, 2021
1 parent 66bb672 commit f5739b8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ consumers. Surely, these platforms would benefit from having greater granularity
purchase behaviour from knowing only the vendor & not the items.

I wanted to make a proof-of-concept using Up Bank's well-documented API & one of, if not the largest Australian grocer:
Woolworths. In short, Woolworths Everyday Rewards API is closed-source & painful to look at. However, they do provide
Woolworths. In short, Woolworths' Everyday Rewards API is closed-source & painful to look at. However, they do provide
customers with ✨e-receipts✨, which is more than I can say for their competitor, Coles' FlyBuy program.

## requirements
Expand Down Expand Up @@ -57,7 +57,7 @@ WOOLIES_TOKEN=8h41...
UP_TOKEN=up:yeah:1234abcd...
```

4. Run `main.py`, look around & have some fun!
4. Run `src/up_woolies/main.py`, look around & have some fun!

```
$ python main.py
Expand Down Expand Up @@ -96,6 +96,10 @@ suggest the feature through support chat in-app 🙏
* 👩‍💼 Talk to someone about Woolworths' API
* I tried reaching out to Woolworths to talk about their API: EverdayRewards support, Quantium (the tech subsidiary
managing the program), even cold-messaged people on LinkedIn associate with WooliesX. No luck.
* ⚡ Talk to someone about Up Bank's smart receipts
* A friend pointed out on [The Tree of Up](https://up.com.au/tree/) a leaf call _smart receipts_ & the existing
integration with AfterPay. It would be interesting to hear how it was implemented, & if this proof-of-concept
shares any similarities.
* 👫 Support 2Up
* Please read [help wanted](#help-wanted) on how you can help push for API support of 2Up.
* ⚖ Interpret item weights
Expand Down
3 changes: 2 additions & 1 deletion src/up_woolies/up.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
from utils import parse_money

# Get token from environment variables
load_dotenv(dotenv_path='../../.env')
for fp in ['../../.env', '.env']:
load_dotenv(dotenv_path=fp)

# Define endpoint & headers
endpoint = "https://api.up.com.au/api/v1/"
Expand Down
6 changes: 2 additions & 4 deletions src/up_woolies/woolies.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
from utils import parse_money

# Get token from environment variables
load_dotenv(dotenv_path='../../.env')
for fp in ['../../.env', '.env']:
load_dotenv(dotenv_path=fp)

# Define endpoint & headers
endpoint = "https://api.woolworthsrewards.com.au/wx/v1/"
Expand All @@ -26,9 +27,6 @@
}


# TODO support for Woolies' partners e.g. BWS, BigW, etc


class Purchase(BaseModel, extra=Extra.ignore):
""" Dataclass of an unique purchased item """
description: str
Expand Down

0 comments on commit f5739b8

Please sign in to comment.