Skip to Content
Mastering Python for Networking and Security
book

Mastering Python for Networking and Security

by José Manuel Ortega
September 2018
Intermediate to advanced
426 pages
10h 46m
English
Packt Publishing
Content preview from Mastering Python for Networking and Security

Chapter 4: HTTP Programming

  1. Which module is the easiest to use since it is designed to facilitate requests to a REST API?

The requests module.

  1. How is a POST request made by passing a dictionary-type data structure that would be sent in the body of the request?

response = requests.post(url, data=data)

  1. What is the correct way to make a POST request through a proxy server and modify the information of the headers at the same time?

requests.post(url,headers=headers,proxies=proxy)

  1. What data structure is necessary to mount if we need to send a request with requests through a proxy?

The dictionary data structure; for example, proxy = {“protocol”:”ip:port”}.

  1. How do we obtain the code of an HTTP request returned by the server if, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Python for Networking and Security - Second Edition

Mastering Python for Networking and Security - Second Edition

José Manuel Ortega
Python for Cybersecurity

Python for Cybersecurity

Howard E. Poston, III

Publisher Resources

ISBN: 9781788992510Supplemental Content