]> code.communitydata.science - taguette_google_sheet_integration.git/commitdiff
urlencode tags in the urls we're generating
authorBenjamin Mako Hill <mako@atdot.cc>
Tue, 28 Feb 2023 01:06:11 +0000 (17:06 -0800)
committerBenjamin Mako Hill <mako@atdot.cc>
Tue, 28 Feb 2023 01:06:11 +0000 (17:06 -0800)
taguette-export_tags_to_csv.py

index d0fd28c4646bb40211cb179eca225d11174df2a3..a3c163f0b516499b4b6147ae180e773b57b3bcdd 100755 (executable)
@@ -6,6 +6,7 @@ import sqlite3
 from configparser import ConfigParser
 import csv
 import os
+import urllib.parse
 
 config_files = [f for f in os.listdir() if f.startswith('.taguette_gdocs')]
 
@@ -58,6 +59,7 @@ for file_path in config_files:
                 category = ""
         
             # create a URL that will link to the list of highlights
-            url = f"https://taguette.communitydata.science/project/{project_id}/highlights/{tag}"
+            tag_url = urllib.parse.quote(tag)
+            url = f"https://taguette.communitydata.science/project/{project_id}/highlights/{tag_url}"
 
             writer.writerow([str(tag_id), axial, tag, category, description, url])

Community Data Science Collective || Want to submit a patch?