python request get html code
# from http://zetcode.com/python/requests/
import requests as req
resp = req.get("http://www.webcode.me")
print(resp.text)
python request get html code
# from http://zetcode.com/python/requests/
import requests as req
resp = req.get("http://www.webcode.me")
print(resp.text)
python http request post json example
>>> import requests
>>> r = requests.post('http://httpbin.org/post', json={"key": "value"})
>>> r.status_code
200
>>> r.json()
{'args': {},
'data': '{"key": "value"}',
'files': {},
'form': {},
'headers': {'Accept': '*/*',
'Accept-Encoding': 'gzip, deflate',
'Connection': 'close',
'Content-Length': '16',
'Content-Type': 'application/json',
'Host': 'httpbin.org',
'User-Agent': 'python-requests/2.4.3 CPython/3.4.0',
'X-Request-Id': 'xx-xx-xx'},
'json': {'key': 'value'},
'origin': 'x.x.x.x',
'url': 'http://httpbin.org/post'}
web server python
# Creating a Web server using Python and Flask
from flask import Flask
app = Flask('app')
@app.route('/')
def run():
return '<h1>Hello, Server!</h1>'
app.run(host = '0.0.0.0', port = 8080)
send get request python
import socket
target_host = "www.google.com"
target_port = 80
# create a socket object
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# connect the client
client.connect((target_host,target_port))
# receive some data
response = client.recv(4096)
print(f'Source Code: {response}')
http_response = repr(response)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us