MCPcopy Create free account
hub / github.com/O365/python-o365 / get_default_drive

Method get_default_drive

O365/drive.py:1869–1892  ·  view source on GitHub ↗

Returns a Drive instance :param request_drive: True will make an api call to retrieve the drive data :return: default One Drive :rtype: Drive

(self, request_drive=False)

Source from the content-addressed store, hash-verified

1867 return 'Storage for resource: {}'.format(self.main_resource)
1868
1869 def get_default_drive(self, request_drive=False):
1870 """ Returns a Drive instance
1871
1872 :param request_drive: True will make an api call to retrieve the drive
1873 data
1874 :return: default One Drive
1875 :rtype: Drive
1876 """
1877 if request_drive is False:
1878 return Drive(con=self.con, protocol=self.protocol,
1879 main_resource=self.main_resource, name='Default Drive')
1880
1881 url = self.build_url(self._endpoints.get('default_drive'))
1882
1883 response = self.con.get(url)
1884 if not response:
1885 return None
1886
1887 drive = response.json()
1888
1889 # Everything received from cloud must be passed as self._cloud_data_key
1890 return self.drive_constructor(con=self.con, protocol=self.protocol,
1891 main_resource=self.main_resource,
1892 **{self._cloud_data_key: drive})
1893
1894 def get_drive(self, drive_id):
1895 """ Returns a Drive instance

Callers 2

__init__Method · 0.80

Calls 4

DriveClass · 0.85
build_urlMethod · 0.80
jsonMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected