Learn Coding: 2 Books in 1: A Practical Guide to Learn Python and SQL. Discover the Secrets of Programming and Avoid Common Mistakes. Exercises Included by Crash Jason

Learn Coding: 2 Books in 1: A Practical Guide to Learn Python and SQL. Discover the Secrets of Programming and Avoid Common Mistakes. Exercises Included by Crash Jason

Author:Crash, Jason [Crash, Jason]
Language: eng
Format: epub
Published: 2020-07-14T16:00:00+00:00


http.client Package

The client package can be used to make HTTP requests. As we saw in the previous section, some of the most important information for HTTP requests are the host address, request method, and resource path. Just clarify this information, plus http. With the help of the client package, you can make an HTTP request.

Here is the code below in Python:

import http.client

connection = http.client.HTTPConnection("www.facebook.com") #hostaddress conn.request("POST", "/") # requestmethod and resource path

response = connection.getresponse() # Gets a response

print(response.status, response.reason)# Replies with status code and description

content = response.read()



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.