You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2021/01/10 19:37:28 UTC

[airavata-django-portal-sdk] branch master updated: urls module for constructing REST API urls

This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal-sdk.git


The following commit(s) were added to refs/heads/master by this push:
     new e9e98e8  urls module for constructing REST API urls
e9e98e8 is described below

commit e9e98e8d41a2e8bf69f93afe14452f2056527e02
Author: Marcus Christie <ma...@iu.edu>
AuthorDate: Fri Jan 8 17:01:41 2021 -0500

    urls module for constructing REST API urls
---
 airavata_django_portal_sdk/urls.py | 9 +++++++++
 docs/index.md                      | 5 +++++
 2 files changed, 14 insertions(+)

diff --git a/airavata_django_portal_sdk/urls.py b/airavata_django_portal_sdk/urls.py
new file mode 100644
index 0000000..9469b0f
--- /dev/null
+++ b/airavata_django_portal_sdk/urls.py
@@ -0,0 +1,9 @@
+from urllib.parse import urlencode
+
+from django.urls import reverse
+
+
+def get_download_url(data_product_uri):
+    """Get URL for downloading data product identified by data_product_uri."""
+    return (reverse("django_airavata_api:download_file") + "?" +
+            urlencode({"data-product-uri": data_product_uri}))
diff --git a/docs/index.md b/docs/index.md
index 66bf149..0e1dd00 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -6,6 +6,11 @@ custom Django app extensions to the
 
 ## API Documentation
 
+### module urls
+
+::: airavata_django_portal_sdk.urls.get_download_url
+    :docstring:
+
 ### module user_storage
 
 ::: airavata_django_portal_sdk.user_storage.save