/gdata/docs/client.py

http://radioappz.googlecode.com/ · Python · 608 lines · 480 code · 40 blank · 88 comment · 35 complexity · 0e0aee6b0154368514d5a393394f5f38 MD5 · raw file

  1. #!/usr/bin/python
  2. #
  3. # Copyright 2009 Google Inc. All Rights Reserved.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. """DocsClient extends gdata.client.GDClient to streamline DocList API calls."""
  17. __author__ = 'e.bidelman (Eric Bidelman)'
  18. import mimetypes
  19. import urllib
  20. import atom.data
  21. import atom.http_core
  22. import gdata.client
  23. import gdata.docs.data
  24. import gdata.gauth
  25. # Feed URI templates
  26. DOCLIST_FEED_URI = '/feeds/default/private/full/'
  27. FOLDERS_FEED_TEMPLATE = DOCLIST_FEED_URI + '%s/contents'
  28. ACL_FEED_TEMPLATE = DOCLIST_FEED_URI + '%s/acl'
  29. REVISIONS_FEED_TEMPLATE = DOCLIST_FEED_URI + '%s/revisions'
  30. class DocsClient(gdata.client.GDClient):
  31. """Client extension for the Google Documents List API."""
  32. host = 'docs.google.com' # default server for the API
  33. api_version = '3.0' # default major version for the service.
  34. auth_service = 'writely'
  35. auth_scopes = gdata.gauth.AUTH_SCOPES['writely']
  36. def __init__(self, auth_token=None, **kwargs):
  37. """Constructs a new client for the DocList API.
  38. Args:
  39. auth_token: (optional) gdata.gauth.ClientLoginToken, AuthSubToken, or
  40. OAuthToken which authorizes this client to edit the user's data.
  41. kwargs: The other parameters to pass to gdata.client.GDClient constructor.
  42. """
  43. gdata.client.GDClient.__init__(self, auth_token=auth_token, **kwargs)
  44. def get_file_content(self, uri, auth_token=None, **kwargs):
  45. """Fetches the file content from the specified uri.
  46. This method is useful for downloading/exporting a file within enviornments
  47. like Google App Engine, where the user does not have the ability to write
  48. the file to a local disk.
  49. Args:
  50. uri: str The full URL to fetch the file contents from.
  51. auth_token: (optional) gdata.gauth.ClientLoginToken, AuthSubToken, or
  52. OAuthToken which authorizes this client to edit the user's data.
  53. kwargs: Other parameters to pass to self.request().
  54. Returns:
  55. The binary file content.
  56. Raises:
  57. gdata.client.RequestError: on error response from server.
  58. """
  59. server_response = self.request('GET', uri, auth_token=auth_token, **kwargs)
  60. if server_response.status != 200:
  61. raise gdata.client.RequestError, {'status': server_response.status,
  62. 'reason': server_response.reason,
  63. 'body': server_response.read()}
  64. return server_response.read()
  65. GetFileContent = get_file_content
  66. def _download_file(self, uri, file_path, auth_token=None, **kwargs):
  67. """Downloads a file to disk from the specified URI.
  68. Note: to download a file in memory, use the GetFileContent() method.
  69. Args:
  70. uri: str The full URL to download the file from.
  71. file_path: str The full path to save the file to.
  72. auth_token: (optional) gdata.gauth.ClientLoginToken, AuthSubToken, or
  73. OAuthToken which authorizes this client to edit the user's data.
  74. kwargs: Other parameters to pass to self.get_file_content().
  75. Raises:
  76. gdata.client.RequestError: on error response from server.
  77. """
  78. f = open(file_path, 'wb')
  79. try:
  80. f.write(self.get_file_content(uri, auth_token=auth_token, **kwargs))
  81. except gdata.client.RequestError, e:
  82. f.close()
  83. raise e
  84. f.flush()
  85. f.close()
  86. _DownloadFile = _download_file
  87. def get_doclist(self, uri=None, limit=None, auth_token=None, **kwargs):
  88. """Retrieves the main doclist feed containing the user's items.
  89. Args:
  90. uri: str (optional) A URI to query the doclist feed.
  91. limit: int (optional) A maximum cap for the number of results to
  92. return in the feed. By default, the API returns a maximum of 100
  93. per page. Thus, if you set limit=5000, you will get <= 5000
  94. documents (guarenteed no more than 5000), and will need to follow the
  95. feed's next links (feed.GetNextLink()) to the rest. See
  96. get_everything(). Similarly, if you set limit=50, only <= 50
  97. documents are returned. Note: if the max-results parameter is set in
  98. the uri parameter, it is chosen over a value set for limit.
  99. auth_token: (optional) gdata.gauth.ClientLoginToken, AuthSubToken, or
  100. OAuthToken which authorizes this client to edit the user's data.
  101. kwargs: Other parameters to pass to self.get_feed().
  102. Returns:
  103. gdata.docs.data.DocList feed.
  104. """
  105. if uri is None:
  106. uri = DOCLIST_FEED_URI
  107. if isinstance(uri, (str, unicode)):
  108. uri = atom.http_core.Uri.parse_uri(uri)
  109. # Add max-results param if it wasn't included in the uri.
  110. if limit is not None and not 'max-results' in uri.query:
  111. uri.query['max-results'] = limit
  112. return self.get_feed(uri, desired_class=gdata.docs.data.DocList,
  113. auth_token=auth_token, **kwargs)
  114. GetDocList = get_doclist
  115. def get_doc(self, resource_id, etag=None, auth_token=None, **kwargs):
  116. """Retrieves a particular document given by its resource id.
  117. Args:
  118. resource_id: str The document/item's resource id. Example spreadsheet:
  119. 'spreadsheet%3A0A1234567890'.
  120. etag: str (optional) The document/item's etag value to be used in a
  121. conditional GET. See http://code.google.com/apis/documents/docs/3.0/
  122. developers_guide_protocol.html#RetrievingCached.
  123. auth_token: (optional) gdata.gauth.ClientLoginToken, AuthSubToken, or
  124. OAuthToken which authorizes this client to edit the user's data.
  125. kwargs: Other parameters to pass to self.get_entry().
  126. Returns:
  127. A gdata.docs.data.DocsEntry object representing the retrieved entry.
  128. Raises:
  129. ValueError if the resource_id is not a valid format.
  130. """
  131. match = gdata.docs.data.RESOURCE_ID_PATTERN.match(resource_id)
  132. if match is None:
  133. raise ValueError, 'Invalid resource id: %s' % resource_id
  134. return self.get_entry(
  135. DOCLIST_FEED_URI + resource_id, etag=etag,
  136. desired_class=gdata.docs.data.DocsEntry,
  137. auth_token=auth_token, **kwargs)
  138. GetDoc = get_doc
  139. def get_everything(self, uri=None, auth_token=None, **kwargs):
  140. """Retrieves the user's entire doc list.
  141. The method makes multiple HTTP requests (by following the feed's next links)
  142. in order to fetch the user's entire document list.
  143. Args:
  144. uri: str (optional) A URI to query the doclist feed with.
  145. auth_token: (optional) gdata.gauth.ClientLoginToken, AuthSubToken, or
  146. OAuthToken which authorizes this client to edit the user's data.
  147. kwargs: Other parameters to pass to self.GetDocList().
  148. Returns:
  149. A list of gdata.docs.data.DocsEntry objects representing the retrieved
  150. entries.
  151. """
  152. if uri is None:
  153. uri = DOCLIST_FEED_URI
  154. feed = self.GetDocList(uri=uri, auth_token=auth_token, **kwargs)
  155. entries = feed.entry
  156. while feed.GetNextLink() is not None:
  157. feed = self.GetDocList(
  158. feed.GetNextLink().href, auth_token=auth_token, **kwargs)
  159. entries.extend(feed.entry)
  160. return entries
  161. GetEverything = get_everything
  162. def get_acl_permissions(self, resource_id, auth_token=None, **kwargs):
  163. """Retrieves a the ACL sharing permissions for a document.
  164. Args:
  165. resource_id: str The document/item's resource id. Example for pdf:
  166. 'pdf%3A0A1234567890'.
  167. auth_token: (optional) gdata.gauth.ClientLoginToken, AuthSubToken, or
  168. OAuthToken which authorizes this client to edit the user's data.
  169. kwargs: Other parameters to pass to self.get_feed().
  170. Returns:
  171. A gdata.docs.data.AclFeed object representing the document's ACL entries.
  172. Raises:
  173. ValueError if the resource_id is not a valid format.
  174. """
  175. match = gdata.docs.data.RESOURCE_ID_PATTERN.match(resource_id)
  176. if match is None:
  177. raise ValueError, 'Invalid resource id: %s' % resource_id
  178. return self.get_feed(
  179. ACL_FEED_TEMPLATE % resource_id, desired_class=gdata.docs.data.AclFeed,
  180. auth_token=auth_token, **kwargs)
  181. GetAclPermissions = get_acl_permissions
  182. def get_revisions(self, resource_id, auth_token=None, **kwargs):
  183. """Retrieves the revision history for a document.
  184. Args:
  185. resource_id: str The document/item's resource id. Example for pdf:
  186. 'pdf%3A0A1234567890'.
  187. auth_token: (optional) gdata.gauth.ClientLoginToken, AuthSubToken, or
  188. OAuthToken which authorizes this client to edit the user's data.
  189. kwargs: Other parameters to pass to self.get_feed().
  190. Returns:
  191. A gdata.docs.data.RevisionFeed representing the document's revisions.
  192. Raises:
  193. ValueError if the resource_id is not a valid format.
  194. """
  195. match = gdata.docs.data.RESOURCE_ID_PATTERN.match(resource_id)
  196. if match is None:
  197. raise ValueError, 'Invalid resource id: %s' % resource_id
  198. return self.get_feed(
  199. REVISIONS_FEED_TEMPLATE % resource_id,
  200. desired_class=gdata.docs.data.RevisionFeed, auth_token=auth_token,
  201. **kwargs)
  202. GetRevisions = get_revisions
  203. def create(self, doc_type, title, folder_or_id=None, writers_can_invite=None,
  204. auth_token=None, **kwargs):
  205. """Creates a new item in the user's doclist.
  206. Args:
  207. doc_type: str The type of object to create. For example: 'document',
  208. 'spreadsheet', 'folder', 'presentation'.
  209. title: str A title for the document.
  210. folder_or_id: gdata.docs.data.DocsEntry or str (optional) Folder entry or
  211. the resouce id of a folder to create the object under. Note: A valid
  212. resource id for a folder is of the form: folder%3Afolder_id.
  213. writers_can_invite: bool (optional) False prevents collaborators from
  214. being able to invite others to edit or view the document.
  215. auth_token: (optional) gdata.gauth.ClientLoginToken, AuthSubToken, or
  216. OAuthToken which authorizes this client to edit the user's data.
  217. kwargs: Other parameters to pass to self.post().
  218. Returns:
  219. gdata.docs.data.DocsEntry containing information newly created item.
  220. """
  221. entry = gdata.docs.data.DocsEntry(title=atom.data.Title(text=title))
  222. entry.category.append(gdata.docs.data.make_kind_category(doc_type))
  223. if isinstance(writers_can_invite, gdata.docs.data.WritersCanInvite):
  224. entry.writers_can_invite = writers_can_invite
  225. elif isinstance(writers_can_invite, bool):
  226. entry.writers_can_invite = gdata.docs.data.WritersCanInvite(
  227. value=str(writers_can_invite).lower())
  228. uri = DOCLIST_FEED_URI
  229. if folder_or_id is not None:
  230. if isinstance(folder_or_id, gdata.docs.data.DocsEntry):
  231. # Verify that we're uploading the resource into to a folder.
  232. if folder_or_id.get_document_type() == gdata.docs.data.FOLDER_LABEL:
  233. uri = folder_or_id.content.src
  234. else:
  235. raise gdata.client.Error, 'Trying to upload item to a non-folder.'
  236. else:
  237. uri = FOLDERS_FEED_TEMPLATE % folder_or_id
  238. return self.post(entry, uri, auth_token=auth_token, **kwargs)
  239. Create = create
  240. def copy(self, source_entry, title, auth_token=None, **kwargs):
  241. """Copies a native Google document, spreadsheet, or presentation.
  242. Note: arbitrary file types and PDFs do not support this feature.
  243. Args:
  244. source_entry: gdata.docs.data.DocsEntry An object representing the source
  245. document/folder.
  246. title: str A title for the new document.
  247. auth_token: (optional) gdata.gauth.ClientLoginToken, AuthSubToken, or
  248. OAuthToken which authorizes this client to edit the user's data.
  249. kwargs: Other parameters to pass to self.post().
  250. Returns:
  251. A gdata.docs.data.DocsEntry of the duplicated document.
  252. """
  253. entry = gdata.docs.data.DocsEntry(
  254. title=atom.data.Title(text=title),
  255. id=atom.data.Id(text=source_entry.GetSelfLink().href))
  256. return self.post(entry, DOCLIST_FEED_URI, auth_token=auth_token, **kwargs)
  257. Copy = copy
  258. def move(self, source_entry, folder_entry=None,
  259. keep_in_folders=False, auth_token=None, **kwargs):
  260. """Moves an item into a different folder (or to the root document list).
  261. Args:
  262. source_entry: gdata.docs.data.DocsEntry An object representing the source
  263. document/folder.
  264. folder_entry: gdata.docs.data.DocsEntry (optional) An object representing
  265. the destination folder. If None, set keep_in_folders to
  266. True to remove the item from all parent folders.
  267. keep_in_folders: boolean (optional) If True, the source entry
  268. is not removed from any existing parent folders it is in.
  269. auth_token: (optional) gdata.gauth.ClientLoginToken, AuthSubToken, or
  270. OAuthToken which authorizes this client to edit the user's data.
  271. kwargs: Other parameters to pass to self.post().
  272. Returns:
  273. A gdata.docs.data.DocsEntry of the moved entry or True if just moving the
  274. item out of all folders (e.g. Move(source_entry)).
  275. """
  276. entry = gdata.docs.data.DocsEntry(id=source_entry.id)
  277. # Remove the item from any folders it is already in.
  278. if not keep_in_folders:
  279. for folder in source_entry.InFolders():
  280. self.delete(
  281. '%s/contents/%s' % (folder.href, source_entry.resource_id.text),
  282. force=True)
  283. # If we're moving the resource into a folder, verify it is a folder entry.
  284. if folder_entry is not None:
  285. if folder_entry.get_document_type() == gdata.docs.data.FOLDER_LABEL:
  286. return self.post(entry, folder_entry.content.src,
  287. auth_token=auth_token, **kwargs)
  288. else:
  289. raise gdata.client.Error, 'Trying to move item into a non-folder.'
  290. return True
  291. Move = move
  292. def upload(self, media, title, folder_or_uri=None, content_type=None,
  293. auth_token=None, **kwargs):
  294. """Uploads a file to Google Docs.
  295. Args:
  296. media: A gdata.data.MediaSource object containing the file to be
  297. uploaded or a string of the filepath.
  298. title: str The title of the document on the server after being
  299. uploaded.
  300. folder_or_uri: gdata.docs.data.DocsEntry or str (optional) An object with
  301. a link to the folder or the uri to upload the file to.
  302. Note: A valid uri for a folder is of the form:
  303. /feeds/default/private/full/folder%3Afolder_id/contents
  304. content_type: str (optional) The file's mimetype. If not provided, the
  305. one in the media source object is used or the mimetype is inferred
  306. from the filename (if media is a string). When media is a filename,
  307. it is always recommended to pass in a content type.
  308. auth_token: (optional) gdata.gauth.ClientLoginToken, AuthSubToken, or
  309. OAuthToken which authorizes this client to edit the user's data.
  310. kwargs: Other parameters to pass to self.post().
  311. Returns:
  312. A gdata.docs.data.DocsEntry containing information about uploaded doc.
  313. """
  314. uri = None
  315. if folder_or_uri is not None:
  316. if isinstance(folder_or_uri, gdata.docs.data.DocsEntry):
  317. # Verify that we're uploading the resource into to a folder.
  318. if folder_or_uri.get_document_type() == gdata.docs.data.FOLDER_LABEL:
  319. uri = folder_or_uri.content.src
  320. else:
  321. raise gdata.client.Error, 'Trying to upload item to a non-folder.'
  322. else:
  323. uri = folder_or_uri
  324. else:
  325. uri = DOCLIST_FEED_URI
  326. # Create media source if media is a filepath.
  327. if isinstance(media, (str, unicode)):
  328. mimetype = mimetypes.guess_type(media)[0]
  329. if mimetype is None and content_type is None:
  330. raise ValueError, ("Unknown mimetype. Please pass in the file's "
  331. "content_type")
  332. else:
  333. media = gdata.data.MediaSource(file_path=media,
  334. content_type=content_type)
  335. entry = gdata.docs.data.DocsEntry(title=atom.data.Title(text=title))
  336. return self.post(entry, uri, media_source=media,
  337. desired_class=gdata.docs.data.DocsEntry,
  338. auth_token=auth_token, **kwargs)
  339. Upload = upload
  340. def download(self, entry_or_id_or_url, file_path, extra_params=None,
  341. auth_token=None, **kwargs):
  342. """Downloads a file from the Document List to local disk.
  343. Note: to download a file in memory, use the GetFileContent() method.
  344. Args:
  345. entry_or_id_or_url: gdata.docs.data.DocsEntry or string representing a
  346. resource id or URL to download the document from (such as the content
  347. src link).
  348. file_path: str The full path to save the file to.
  349. extra_params: dict (optional) A map of any further parameters to control
  350. how the document is downloaded/exported. For example, exporting a
  351. spreadsheet as a .csv: extra_params={'gid': 0, 'exportFormat': 'csv'}
  352. auth_token: (optional) gdata.gauth.ClientLoginToken, AuthSubToken, or
  353. OAuthToken which authorizes this client to edit the user's data.
  354. kwargs: Other parameters to pass to self._download_file().
  355. Raises:
  356. gdata.client.RequestError if the download URL is malformed or the server's
  357. response was not successful.
  358. ValueError if entry_or_id_or_url was a resource id for a filetype
  359. in which the download link cannot be manually constructed (e.g. pdf).
  360. """
  361. if isinstance(entry_or_id_or_url, gdata.docs.data.DocsEntry):
  362. url = entry_or_id_or_url.content.src
  363. else:
  364. if gdata.docs.data.RESOURCE_ID_PATTERN.match(entry_or_id_or_url):
  365. url = gdata.docs.data.make_content_link_from_resource_id(
  366. entry_or_id_or_url)
  367. else:
  368. url = entry_or_id_or_url
  369. if extra_params is not None:
  370. if 'exportFormat' in extra_params and url.find('/Export?') == -1:
  371. raise gdata.client.Error, ('This entry type cannot be exported '
  372. 'as a different format.')
  373. if 'gid' in extra_params and url.find('spreadsheets') == -1:
  374. raise gdata.client.Error, 'gid param is not valid for this doc type.'
  375. url += '&' + urllib.urlencode(extra_params)
  376. self._download_file(url, file_path, auth_token=auth_token, **kwargs)
  377. Download = download
  378. def export(self, entry_or_id_or_url, file_path, gid=None, auth_token=None,
  379. **kwargs):
  380. """Exports a document from the Document List in a different format.
  381. Args:
  382. entry_or_id_or_url: gdata.docs.data.DocsEntry or string representing a
  383. resource id or URL to download the document from (such as the content
  384. src link).
  385. file_path: str The full path to save the file to. The export
  386. format is inferred from the the file extension.
  387. gid: str (optional) grid id for downloading a single grid of a
  388. spreadsheet. The param should only be used for .csv and .tsv
  389. spreadsheet exports.
  390. auth_token: (optional) gdata.gauth.ClientLoginToken, AuthSubToken, or
  391. OAuthToken which authorizes this client to edit the user's data.
  392. kwargs: Other parameters to pass to self.download().
  393. Raises:
  394. gdata.client.RequestError if the download URL is malformed or the server's
  395. response was not successful.
  396. """
  397. extra_params = {}
  398. match = gdata.docs.data.FILE_EXT_PATTERN.match(file_path)
  399. if match:
  400. extra_params['exportFormat'] = match.group(1)
  401. if gid is not None:
  402. extra_params['gid'] = gid
  403. self.download(entry_or_id_or_url, file_path, extra_params,
  404. auth_token=auth_token, **kwargs)
  405. Export = export
  406. class DocsQuery(gdata.client.Query):
  407. def __init__(self, title=None, title_exact=None, opened_min=None,
  408. opened_max=None, edited_min=None, edited_max=None, owner=None,
  409. writer=None, reader=None, show_folders=None,
  410. show_deleted=None, ocr=None, target_language=None,
  411. source_language=None, convert=None, **kwargs):
  412. """Constructs a query URL for the Google Documents List API.
  413. Args:
  414. title: str (optional) Specifies the search terms for the title of a
  415. document. This parameter used without title_exact will only
  416. submit partial queries, not exact queries.
  417. title_exact: str (optional) Meaningless without title. Possible values
  418. are 'true' and 'false'. Note: Matches are case-insensitive.
  419. opened_min: str (optional) Lower bound on the last time a document was
  420. opened by the current user. Use the RFC 3339 timestamp
  421. format. For example: opened_min='2005-08-09T09:57:00-08:00'.
  422. opened_max: str (optional) Upper bound on the last time a document was
  423. opened by the current user. (See also opened_min.)
  424. edited_min: str (optional) Lower bound on the last time a document was
  425. edited by the current user. This value corresponds to the
  426. edited.text value in the doc's entry object, which
  427. represents changes to the document's content or metadata.
  428. Use the RFC 3339 timestamp format. For example:
  429. edited_min='2005-08-09T09:57:00-08:00'
  430. edited_max: str (optional) Upper bound on the last time a document was
  431. edited by the user. (See also edited_min.)
  432. owner: str (optional) Searches for documents with a specific owner. Use
  433. the email address of the owner. For example:
  434. owner='user@gmail.com'
  435. writer: str (optional) Searches for documents which can be written to
  436. by specific users. Use a single email address or a comma
  437. separated list of email addresses. For example:
  438. writer='user1@gmail.com,user@example.com'
  439. reader: str (optional) Searches for documents which can be read by
  440. specific users. (See also writer.)
  441. show_folders: str (optional) Specifies whether the query should return
  442. folders as well as documents. Possible values are 'true'
  443. and 'false'. Default is false.
  444. show_deleted: str (optional) Specifies whether the query should return
  445. documents which are in the trash as well as other
  446. documents. Possible values are 'true' and 'false'.
  447. Default is false.
  448. ocr: str (optional) Specifies whether to attempt OCR on a .jpg, .png, or
  449. .gif upload. Possible values are 'true' and 'false'. Default is
  450. false. See OCR in the Protocol Guide:
  451. http://code.google.com/apis/documents/docs/3.0/developers_guide_protocol.html#OCR
  452. target_language: str (optional) Specifies the language to translate a
  453. document into. See Document Translation in the Protocol
  454. Guide for a table of possible values:
  455. http://code.google.com/apis/documents/docs/3.0/developers_guide_protocol.html#DocumentTranslation
  456. source_language: str (optional) Specifies the source language of the
  457. original document. Optional when using the translation
  458. service. If not provided, Google will attempt to
  459. auto-detect the source language. See Document
  460. Translation in the Protocol Guide for a table of
  461. possible values (link in target_language).
  462. convert: str (optional) Used when uploading arbitrary file types to
  463. specity if document-type uploads should convert to a native
  464. Google Docs format. Possible values are 'true' and 'false'.
  465. The default is 'true'.
  466. """
  467. gdata.client.Query.__init__(self, **kwargs)
  468. self.convert = convert
  469. self.title = title
  470. self.title_exact = title_exact
  471. self.opened_min = opened_min
  472. self.opened_max = opened_max
  473. self.edited_min = edited_min
  474. self.edited_max = edited_max
  475. self.owner = owner
  476. self.writer = writer
  477. self.reader = reader
  478. self.show_folders = show_folders
  479. self.show_deleted = show_deleted
  480. self.ocr = ocr
  481. self.target_language = target_language
  482. self.source_language = source_language
  483. def modify_request(self, http_request):
  484. gdata.client._add_query_param('convert', self.convert, http_request)
  485. gdata.client._add_query_param('title', self.title, http_request)
  486. gdata.client._add_query_param('title-exact', self.title_exact,
  487. http_request)
  488. gdata.client._add_query_param('opened-min', self.opened_min, http_request)
  489. gdata.client._add_query_param('opened-max', self.opened_max, http_request)
  490. gdata.client._add_query_param('edited-min', self.edited_min, http_request)
  491. gdata.client._add_query_param('edited-max', self.edited_max, http_request)
  492. gdata.client._add_query_param('owner', self.owner, http_request)
  493. gdata.client._add_query_param('writer', self.writer, http_request)
  494. gdata.client._add_query_param('reader', self.reader, http_request)
  495. gdata.client._add_query_param('showfolders', self.show_folders,
  496. http_request)
  497. gdata.client._add_query_param('showdeleted', self.show_deleted,
  498. http_request)
  499. gdata.client._add_query_param('ocr', self.ocr, http_request)
  500. gdata.client._add_query_param('targetLanguage', self.target_language,
  501. http_request)
  502. gdata.client._add_query_param('sourceLanguage', self.source_language,
  503. http_request)
  504. gdata.client.Query.modify_request(self, http_request)
  505. ModifyRequest = modify_request