question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: request() got an unexpected keyword argument 'json' when opening Sheet

See original GitHub issue

When attempting to open a spreadsheet with following function:

def openSS(bookName, sheetName):
        if not os.path.isfile(gsJSONFile):
                print("JSON client file does not exist!")
                sys.exit(2)
        scope = ['https://spreadsheets.google.com/feeds']
        credentials = ServiceAccountCredentials.from_json_keyfile_name(gsJSONFile, scope)
        gc = gspread.authorize(credentials)
        wks = gc.open(bookName).worksheet(sheetName)
        return wks

I’m getting this error, but I don’t get it when running exact same file on a Macbook Pro:

  File "github/Scripts/Python/weather.py", line 268, in autoMode
    wks = openSS("Weather API", "Current")
  File "github/Scripts/Python/weather.py", line 51, in openSS
    wks = gc.open(bookName).worksheet(sheetName)
  File "/usr/local/lib/python2.7/dist-packages/gspread/client.py", line 82, in open
    feed = self.get_spreadsheets_feed()
  File "/usr/local/lib/python2.7/dist-packages/gspread/client.py", line 155, in get_spreadsheets_feed
    r = self.session.get(url)
  File "/usr/local/lib/python2.7/dist-packages/gspread/httpsession.py", line 73, in get
    return self.request('GET', url, params=params, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/gspread/httpsession.py", line 65, in request
    response = func(url, data=data, params=params, headers=request_headers, files=files, json=json)
  File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 467, in get
    return self.request('GET', url, **kwargs)
TypeError: request() got an unexpected keyword argument 'json'

Operating System: Ubuntu 14.04 Python version: 2.7.6 gspread version: just re-installed it with pip, so latest.

Thanks in advance!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7

github_iconTop GitHub Comments

5reactions
jaggadcommented, Jan 21, 2017

Solved by updating requests package.

1reaction
adamanticcommented, Aug 28, 2017

Solved this via sudo pip3 requests --upgarde as well

Read more comments on GitHub >

github_iconTop Results From Across the Web

request() got an unexpected keyword argument 'json' [duplicate]
I need to send data as json with requests module in Python. For example: import json import requests f = requests.Session() data =...
Read more >
TypeError: request() got an unexpected keyword argument 'json ...
When attempting to open a spreadsheet with following function: def openSS(bookName, sheetName): if not os.path.isfile(gsJSONFile): print("JSON client file ...
Read more >
request() got an unexpected keyword argument 'req_params'
Hello! I have recently become the primary caretaker of Bodhi and I've inherited a number of issues related to bodhi 0.9.
Read more >
pandas.ExcelWriter — pandas 1.5.2 documentation
Class for writing DataFrame objects into excel sheets. Default is to use: ... NOTE: can only be passed as a keyword argument. ......
Read more >
st.json - Streamlit Docs
st.json displays object or string as a pretty-printed JSON string. ... Defaults to True. This argument can only be supplied by keyword.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found