burnash / gspread

Google Sheets Python API

Home Page:https://docs.gspread.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gspread insert_permission() has a bug

audacesk opened this issue · comments

Description of the bug
The parameter "notify" from the function insert_permission() doesn't work. Whether I set it up to False, True or None, it will send an email notification. I'm looking to not notify with an email the permission receiver.

Code*

import pandas as pd
import utils as utils
import variables as variables
from tqdm import tqdm
from glob import glob
import gspread


##############################################################################
# SETUP #
##############################################################################
gc = gspread.service_account(filename=variables.GCP_CRED_PTH_GSHEET)

sh = gc.create(title='AUTOMATION TESTING v6')
print(sh.id)
print(sh.url)

# Read CSV file contents
content = open('xxxx.csv', 'r').read()

# gc.import_csv(spreadsheet.id, content)
gc.import_csv(sh.id, content)

gc.insert_permission(
    sh.id,
    'xxxxxx@xxxx.com',
    perm_type='user',
    role='writer',
    # notify=None,
    notify=False
)

Environment info:

  • Operating System: macOS
  • Python version: 3.9.12
  • gspread version: 5.5.0

Hi! Thanks for the issue :)

This issue exists because you are using gspread v5.5.0. In this version, the parameter for sendNotificationEmail (see google API docs) is spelt wrong (it has an extra s). Thus, it will not work whatever you give it.

"sendNotificationEmails": notify,

This issue was fixed in version 5.6.0 by #1115

To fix this issue, please update gspread to a version >= v5.6.0