get requests python code example
Example 1: python request get html code
import requests as req
resp = req.get("http://www.webcode.me")
print(resp.text)
Example 2: get request python
import requests
x = requests.get('https://w3schools.com')
print(x.status_code)
Example 3: get requests python
import requests
r = requests.get('https://api.github.com', auth=('user', 'pass'))
print r.status_code
print r.headers['content-type']
Example 4: python requests get
import requests
req = requests.get('<url here>', 'html.parser')
print(req.text)
Example 5: send get request python
import socket
target_host = "www.google.com"
target_port = 80
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect((target_host,target_port))
response = client.recv(4096)
print(f'Source Code: {response}')
http_response = repr(response)