Comments (5)
I went through the list of missing actions it seems the new HTTP client is missing the bellow actions:
- export
- list_permissions
- insert_permission/share
- remove_permission
I will fix that soon (in a couple of days at most) and make the next fixup release 6.0.1
thank you everyone for helping.
from gspread.
I saw your first investigation I thought you wanted to continue when you have time.
I understand, I'll have a look then.
I think we can provide a fix for both issues that just raised and then release 6.0.1 with both fixes, you agree ?
from gspread.
@Joangaes, sorry for taking advantage of your issue, but I had a similar problem so I'll just add it here. It was with the export function.
Traceback (most recent call last):
File "xxx.py", line xxx, in <module>
export_file = workbook.export(format=ExportFormat.EXCEL)
File "/home/xxx/oss/changehistory/venv/lib/python3.8/site-packages/gspread/spreadsheet.py", line 518, in export
return self.client.export(self.id, format)
AttributeError: 'HTTPClient' object has no attribute 'export'
Here's what I've tried:
import gspread
gc = gspread.service_account()
sh = gc.open("XXX").export()
from gspread.
Hi, thanks for the issue :)
This seems to be a big problem with the new release. For now I would consider using the latest version v5.12.4 until this is fixed, with
pip install gspread==5.12.4
Information
I am not sure what the problem is, but I provide relevant parts of code for v5 and v6
v5 (old, working)
class Client:
def __init__(self, auth, session=None):
if auth is not None:
self.auth = convert_credentials(auth)
self.session = session or AuthorizedSession(self.auth)
else:
self.session = session
self.timeout = None
def open(self, title, folder_id=None):
spreadsheet_files, response = self._list_spreadsheet_files(title, folder_id)
try:
properties = finditem(
lambda x: x["name"] == title,
spreadsheet_files,
)
except StopIteration as ex:
raise SpreadsheetNotFound(response) from ex
# Drive uses different terminology
properties["title"] = properties["name"]
return Spreadsheet(self, properties)
class Spreadsheet:
def __init__(self, client, properties):
self.client = client
...
def export(self, format=ExportFormat.PDF):
return self.client.export(self.id, format)
v6 (new, broken)
class Client:
def __init__(
self, auth: Credentials, http_client: HTTPClientType = HTTPClient
) -> None:
self.http_client = http_client(auth)
def open(self, title: str, folder_id: Optional[str] = None) -> Spreadsheet:
spreadsheet_files, response = self._list_spreadsheet_files(title, folder_id)
try:
properties = finditem(
lambda x: x["name"] == title,
spreadsheet_files,
)
except StopIteration as ex:
raise SpreadsheetNotFound(response) from ex
# Drive uses different terminology
properties["title"] = properties["name"]
return Spreadsheet(self.http_client, properties)
class Spreadsheet:
def __init__(self, http_client, properties):
self.client = http_client
...
def export(self, format=ExportFormat.PDF):
return self.client.export(self.id, format)
I must go now but the investigation can be continued from here. Looks like a problem with what is passed to the Spreadsheet
initialisation, as one passes an entire Client
object, and the other just the http_client
, which does not have the export
method attached to it.
from gspread.
@lavigne958 you assign me but I do not know much about the Client
object, perhaps it is better if you take a look as you know more about it and the changes that were made v5->v6?
from gspread.
Related Issues (20)
- add `get_records` changes to README migration guide HOT 1
- Merge Master into branch feature/release_6_0_0
- Cannot use `session` with `Client()` in v6.0.0 HOT 4
- gspread 6.0.0 OAuth requires re-authentication every time. HOT 9
- Update all artifacts to remove python 3.7 HOT 3
- Client has no attribute set_timeout HOT 7
- Typo in `oauth_from_dict` HOT 1
- gspread 6.0.0 no longer compatible with gspread-formatting HOT 13
- rework permission methods HOT 2
- Release 6.0.1 HOT 3
- py.typed is not included HOT 1
- return empty cell to old default (None not "None") HOT 1
- Gspread 6.0.0: gspread.oauth() triggers Error 400: redirect_uri_mismatch HOT 9
- Error cannot import name 'Literal' from 'typing' - gspread 6.0.0, python3.7 HOT 1
- Add new `Worksheet` init arguments to migration guide
- Update examples of gspread usage /Readme.md HOT 8
- Reorder gspread client init arguments HOT 1
- improve documentation HOT 2
- cell.expand('table') feature requests HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gspread.