aca1803
aca1803

Reputation: 21

"reserved word in the urls" error in python code

This is my error message:

{"requestId":"b29fdb37-816d-4cde-b8ee-a9181f27a7a4","errorCode":"InstanceReservedWordNotAllowedInEntryKey","errorMessage":"Entry key \"https://________/BWBR0005537/2023-08-01/#___________1.1_Artikel1:2\" contains reserved word \":\""}

This is my code snippet for related issue:

import urllib.parse

if not pd.isnull(row['resource']) and isinstance(row['resource'], str) and row['resource'].strip() != "":
    url = row['resource']
    
    # Encode special characters in the URL
    encoded_url = urllib.parse.unquote(url)

    url_updated = encoded_url
    # url_updated = url
    if not (url.startswith("http://") or url.startswith("https://")):
        url_updated = "http://" + url_updated  # Prepend 'http://' if it is not there
    term.resources = [{
        "displayName": url,
        "url": url_updated
    }] 

How can handle with this issue?

Upvotes: 0

Views: 40

Answers (0)

Related Questions