Skip to content

Commit 930bf67

Browse files
yuvipandau10313335
authored andcommitted
Use urlencode to construct query strings
1 parent c948d78 commit 930bf67

File tree

1 file changed

+3
-4
lines changed
  • repo2docker/contentproviders

1 file changed

+3
-4
lines changed

repo2docker/contentproviders/ckan.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from datetime import datetime, timedelta, timezone
22
from os import path
3-
from urllib.parse import parse_qs, urlparse
3+
from urllib.parse import parse_qs, urlparse, urlencode
44

55
from requests import Session
66

@@ -86,11 +86,10 @@ def fetch(self, spec, output_dir, yield_output=False):
8686
# handle the activites
8787
if activity_id:
8888
fetch_url = (
89-
f"{spec['api_url']}activity_data_show?"
90-
f"id={activity_id}&object_type=package"
89+
f"{spec['api_url']}activity_data_show?" + urlencode({"id": activity_id, "object_type": "package"})
9190
)
9291
else:
93-
fetch_url = f"{spec['api_url']}package_show?id={dataset_id}"
92+
fetch_url = f"{spec['api_url']}package_show?" + urlencode({"id": dataset_id})
9493

9594
resp = self.urlopen(
9695
fetch_url,

0 commit comments

Comments
 (0)