pyicloud
pyicloud copied to clipboard
KeyError: "clientid"
The problem
I get an error when I run api.drive.mkdir("NewFolder"), in attempt to create a folder in the root directory. I actually don't know if it's the right way to do it tho...
Environment
- pyiCloud release with the issue (
pip show pyicloud
): 1.0.0 - Last working pyiCloud release (if known):
- Service causing this issue: Drive
- Python version (
python -V
): 3.9.12 - Operating environment (project deps/Docker/Windows/etc.): Windows 10
Traceback/Error logs
Traceback:
File "C:\Users\(myuser)\anaconda3\lib\site-packages\pyicloud\services\drive.py", line 319, in mkdir
return self.connection.create_folders(self.data["drivewsid"], folder)
File "C:\Users\(myuser)\anaconda3\lib\site-packages\pyicloud\services\drive.py", line 169, in create_folders
"clientId": self.params["clientId"]
KeyError: "clientid"
Checklist
- [x] I've looked informations into the README.
- [ ] I've looked informations into the pyiCloud's code.
- [ ] I've looked informations in Google.
Additional information
Update: Fixed by adding
self.params['clientId'] = self.client_id
to base.py, like so:
def drive(self):
"""Gets the 'Drive' service."""
if not self._drive:
self.params['clientId'] = self.client_id
self._drive = DriveService(
service_root=self._get_webservice_url("drivews"),
document_root=self._get_webservice_url("docws"),
session=self.session,
params=self.params,
)
return self._drive
I've tried doing this api._drive.params["clientId"] = api.client_id
just before creating the folder and seems to work as well (to avoid having to modify base.py
)