marketplace.py 517 B

12345678910111213141516
  1. from yarl import URL
  2. from configs import dify_config
  3. from core.helper.download import download_with_size_limit
  4. def get_plugin_pkg_url(plugin_unique_identifier: str):
  5. return (URL(str(dify_config.MARKETPLACE_API_URL)) / "api/v1/plugins/download").with_query(
  6. unique_identifier=plugin_unique_identifier
  7. )
  8. def download_plugin_pkg(plugin_unique_identifier: str):
  9. url = str(get_plugin_pkg_url(plugin_unique_identifier))
  10. return download_with_size_limit(url, dify_config.PLUGIN_MAX_PACKAGE_SIZE)