Skip to content

Commit

Permalink
Upgrade gspread to latest
Browse files Browse the repository at this point in the history
This newer version of the library requires a `Path` object, not just a
`str`, so update accordingly.
  • Loading branch information
DavidCain committed May 10, 2024
1 parent 1ac1b12 commit a0ca3ae
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
25 changes: 21 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions ws/utils/member_sheets.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from collections.abc import Iterable, Iterator
from datetime import timedelta
from itertools import zip_longest
from pathlib import Path
from typing import Any, NamedTuple

import gspread
Expand Down Expand Up @@ -219,7 +220,7 @@ def update_participant(
Much more efficient than updating the entire sheet.
"""
client = gspread.service_account(settings.OAUTH_JSON_CREDENTIALS)
client = gspread.service_account(Path(settings.OAUTH_JSON_CREDENTIALS))
wks = client.open_by_key(discount.ga_key).sheet1
writer = SheetWriter(discount, trust_cache=False)

Expand Down Expand Up @@ -250,7 +251,7 @@ def update_discount_sheet(discount: models.Discount, trust_cache: bool) -> None:
For individual updates, this approach should be avoided (instead, opting to
update individual cells in the spreadsheet).
"""
client = gspread.service_account(settings.OAUTH_JSON_CREDENTIALS)
client = gspread.service_account(Path(settings.OAUTH_JSON_CREDENTIALS))
wks: gspread.worksheet.Worksheet = client.open_by_key(discount.ga_key).sheet1
participants = list(
discount.participant_set.select_related("membership", "user").order_by("name")
Expand Down

0 comments on commit a0ca3ae

Please sign in to comment.