Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

List Sheet in folder #117

Open
bboylord opened this issue Oct 4, 2018 · 2 comments
Open

List Sheet in folder #117

bboylord opened this issue Oct 4, 2018 · 2 comments

Comments

@bboylord
Copy link

bboylord commented Oct 4, 2018

Hi,
I am trying to list all the sheets that I have in a folder, however I have the following issue:

`C:\Python27\python.exe "C:/Python27/Labs/Cisco Smartsheet/SS_LIST_Sheet.py"
You are Working on folder : Dev Leer Smart-Sheet
Traceback (most recent call last):
File "C:/Python27/Labs/Cisco Smartsheet/SS_LIST_Sheet.py", line 17, in
print response._sheets
File "C:\Python27\lib\site-packages\smartsheet\types.py", line 82, in str
return json.dumps(self._store)
File "C:\Python27\lib\site-packages\openpyxl-2.4.0a1-py2.7.egg\json_init
.py", line 244, in dumps
return _default_encoder.encode(obj)
File "C:\Python27\lib\site-packages\openpyxl-2.4.0a1-py2.7.egg\json\encoder.py", line 207, in encode
chunks = self.iterencode(o, _one_shot=True)
File "C:\Python27\lib\site-packages\openpyxl-2.4.0a1-py2.7.egg\json\encoder.py", line 270, in iterencode
return _iterencode(o, 0)
File "C:\Python27\lib\site-packages\openpyxl-2.4.0a1-py2.7.egg\json\encoder.py", line 184, in default
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: <smartsheet.models.sheet.Sheet object at 0x02AEB610> is not JSON serializable

Process finished with exit code 1
`

My code is this:
`# -- coding: utf-8 --

!/usr/bin/python

import pprint
import json
import smartsheet

access_token = 'MyToken'
ss_client = smartsheet.Smartsheet(access_token)
#response = ss_client.Sheets.list_sheets(include_all=True)

response = ss_client.Folders.get_folder(
7197610382518148)

print "You are Working on folder : " + response._name
print response._sheets`

@timwellswa
Copy link
Contributor

Can you enable logging and post a sanitized log of the JSON response?

@bboylord
Copy link
Author

I activated the log in the past

import logging logging.basicConfig(filename='mylog.log', level=logging.DEBUG)

The issue is C:\Python27\python.exe "C:/Python27/Labs/Cisco Smartsheet/SS_LIST_Sheet.py" Traceback (most recent call last): File "C:/Python27/Labs/Cisco Smartsheet/SS_LIST_Sheet.py", line 24, in <module> print response.sheets File "C:\Python27\lib\site-packages\smartsheet\types.py", line 82, in __str__ return json.dumps(self.__store) File "C:\Python27\lib\site-packages\openpyxl-2.4.0a1-py2.7.egg\json\__init__.py", line 244, in dumps return _default_encoder.encode(obj) You are Working on folder : Dev Leer Smart-Sheet File "C:\Python27\lib\site-packages\openpyxl-2.4.0a1-py2.7.egg\json\encoder.py", line 207, in encode Otra Forma chunks = self.iterencode(o, _one_shot=True) File "C:\Python27\lib\site-packages\openpyxl-2.4.0a1-py2.7.egg\json\encoder.py", line 270, in iterencode return _iterencode(o, 0) File "C:\Python27\lib\site-packages\openpyxl-2.4.0a1-py2.7.egg\json\encoder.py", line 184, in default raise TypeError(repr(o) + " is not JSON serializable") TypeError: <smartsheet.models.sheet.Sheet object at 0x02B5C630> is not JSON serializable

But the Log has the information.

mylog file has the information:
NFO:smartsheet.smartsheet:Request: { command: GET https://api.smartsheet.com/2.0/folders/7197610382518148 } DEBUG:smartsheet.smartsheet:Response: { status: 200 OK content: { { "id": 7197610382518148, "name": "Dev Leer Smart-Sheet", "permalink": "https://app.smartsheet.com/b/home?lx=mzmX_obZb71mT52MWj9v2F113tjZfBYMXSEruozjq1E", "sheets": [ { "accessLevel": "OWNER", "createdAt": "2018-10-04T01:15:57Z", "id": 4989044347168788, "modifiedAt": "2018-10-04T01:15:57Z", "name": "Sheet1", "permalink": "https://app.smartsheet.com/b/home?lx=jVN-jmD-td3ky3CCvi128A" }, { "accessLevel": "OWNER", "createdAt": "2018-10-04T01:16:25Z", "id": 3137853313050578, "modifiedAt": "2018-10-04T01:17:40Z", "name": "Sheet2", "permalink": "https://app.smartsheet.com/b/home?lx=Qp_jlF3ts3E8lgs0iEwwYw" }, { "accessLevel": "OWNER", "createdAt": "2018-10-04T03:45:29Z", "id": 7353612822177645, "modifiedAt": "2018-10-04T03:45:29Z", "name": "Test_lista", "permalink": "https://app.smartsheet.com/b/home?lx=rxYULW2diLw8iffZX2w6bw" } ] } }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants