File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -226,6 +226,31 @@ def list_plugins(self):
226226 """
227227 return self ._perform_json ("GET" , "/plugins/" )
228228
229+ def download_plugin_stream (self , plugin_id ):
230+ """
231+ Download a development plugin, as a binary stream
232+ :param str plugin_id: identifier of the plugin to download
233+
234+ :param plugin_id:
235+ :return: the binary stream
236+ """
237+ return self ._perform_raw ("GET" , "/plugins/%s/download" % plugin_id )
238+
239+ def download_plugin_to_file (self , plugin_id , path ):
240+ """
241+ Download a development plugin to a file
242+
243+ :param str plugin_id: identifier of the plugin to download
244+ :param str path: the path where to download the plugin
245+ :return: None
246+ """
247+ stream = self .download_plugin_stream (plugin_id )
248+ with open (path , 'wb' ) as f :
249+ for chunk in stream .iter_content (chunk_size = 10000 ):
250+ if chunk :
251+ f .write (chunk )
252+ f .flush ()
253+
229254 def install_plugin_from_archive (self , fp ):
230255 """
231256 Install a plugin from a plugin archive (as a file object)
You can’t perform that action at this time.
0 commit comments