Skip to content

Latest commit

 

History

History
118 lines (97 loc) · 5.44 KB

File metadata and controls

118 lines (97 loc) · 5.44 KB

0x10. Python - Network #0

0. cURL body size mandatory

Write a Bash script takes in a URL, sends a request to that URL, and displays the size of the body of the response

  • The size must be displayed in bytes
  • You have to use curl

Please test your script in the container provided, using the web server running on port 5000

1. cURL to the end mandatory

Write a Bash script that takes in a URL, sends a GET request to the URL, and displays the body of the response

  • Display only body of a 200 status code response
  • You have to use curl

Please test your script in the container provided, using the web server running on port 5000

2. cURL Method mandatory

Write a Bash script that sends a DELETE request to the URL passed as the first argument and displays the body of the response

  • You have to use curl

Please test your script in the container provided, using the web server running on port 5000

3. cURL only methods mandatory

Write a Bash script that takes in a URL and displays all HTTP methods the server will accept.

  • You have to use curl

Please test your script in the container provided, using the web server running on port 5000

4. cURL headers mandatory

Write a Bash script that takes in a URL as an argument, sends a GET request to the URL, and displays the body of the response

  • A header variable X-HolbertonSchool-User-Id must be sent with the value 98
  • You have to use curl

Please test your script in the container provided, using the web server running on port 5000

5. cURL POST parameters mandatory

Write a Bash script that takes in a URL, sends a POST request to the passed URL, and displays the body of the response

  • A variable email must be sent with the value [email protected]
  • A variable subject must be sent with the value I will always be here for PLD
  • You have to use curl

Please test your script in the container provided, using the web server running on port 5000

6. Find a peak mandatory

Technical interview preparation:

  • You are not allowed to google anything
  • Whiteboard first

Write a function that finds a peak in a list of unsorted integers.

  • Prototype: def find_peak(list_of_integers):
  • You are not allowed to import any module
  • Your algorithm must have the lowest complexity
  • 6-peak.py must contain the function
  • 6-peak.txt must contain the complexity of your algorithm: O(log(n)), O(n), O(nlog(n)) or O(n2)

7. Only status code #advanced

Write a Bash script that sends a request to a URL passed as an argument, and displays only the status code of the response.

  • You are not allowed to use any pipe, redirection, etc.
  • You are not allowed to use ; and &&
  • You have to use curl

Please test your script in the container provided, using the web server running on port 5000

8. cURL a JSON file #advanced

Write a Bash script that sends a JSON POST request to a URL passed as the first argument, and displays the body of the response.

  • Your script must send a POST request with the contents of a file, passed with the filename as the second argument of the script, in the body of the request
  • You have to use curl

Please test your scripts in the container provided, using the web server running on port 5000

9. Catch me if you can! #advanced

Write a Bash script that makes a request to 0.0.0.0:5000/catch_me that causes the server to respond with a message containing You got me!, in the body of the response.

  • You have to use curl
  • You are not allow to use echo, cat, etc. to display the final result

Please test your script in the container provided, using the web server running on port 5000