0

I am new to curl and I am using it with the canvas api and python to update a discussions description like so

subprocess.call(['curl', '-X', 'PUT', url, '-F', title, '-F', desc, '-H', auth])

this is successful however I get

Warning: skip unknown form field: "><tbody><tr><td style='border: 1px solid

when I put a ; in desc. desc is HTML and CSS.

Example:

This works

desc = 'message = <table style = "width: 30%">...</table>'

This does not work

desc = 'message = <table style="width: 30%;">...</table>'

notice the ; after 30% which is triggering the warning

I would like to be able to do <table style="width: 30%; border: 1px solid;"><tbody>... but since I currently cant have ;'s I am unable to do so.

How can I use semicolons inside of my curl call like this?

Barmar
  • 741,623
  • 53
  • 500
  • 612
  • You need to percent-encode the `=` inside the parameter value. – Barmar Mar 07 '22 at 17:26
  • 2
    Why are you using `curl` instead of the `requests` module? It will take care of parameter encoding for you. – Barmar Mar 07 '22 at 17:26
  • I am working off of my professors, old code and he used curl, I will look into the requests module thanks! – NicFornicola Mar 07 '22 at 17:40
  • 2
    See https://stackoverflow.com/questions/5607551/how-to-urlencode-a-querystring-in-python for the way to encode the query string. – Barmar Mar 07 '22 at 17:42

0 Answers0