decodeURIComponent in server script

in client script I am using decodeURIComponent to decode a give string. Is there a possibilty to do this in server script also?

I already tried to import urllib.parse, but it gave my an error, because for security reason it’s not allowed. But is there another way?

ImportError: __import__ not found
Possible source of error: **Server Script**

thx4help

@Andreas_Thuer import frappe
from urllib.parse import unquote
encoded_string = “Hello%20World%21”
decoded_string = unquote(encoded_string)

It gave me this error:

ImportError: __import__ not found
Possible source of error: Server Script

If you are use the server script doctype then check the reference:

@NCP This is what I already know, therefore my question is there a possibility to decode/unqoute a string in server scripts?

What I want to do:
I want to create a new doc (payment request) on submit a sales invoice with all the needed information => this is working almost 95% :wink:
But I need to send message to payment request, because frappe.get_doc is not fetching data from templates. Create docs with frappe.db.insert

br
Andreas