Home » Php » How do I respond to an HTTP get request with Python

How do I respond to an HTTP get request with Python

Posted by: admin October 29, 2018 Leave a comment

Questions:

The webhook I am building needs to respond to an HTTP GET request, with a body containing the value of a query parameter.

The HTTP GET looks like this:

GET https://example.com?challenge=8ec8d794-e0ab-42df-9017-e3dada8e84f7

This PHP script works…

<?php
 header('Content-Type: text/plain');
 echo $_GET['challenge']; 
?>

How would I replicate this in Python? Ideally without having to execute the PHP script within Python.

Thanks,

Answers: