Python Web Requests
import requests
#We often have to automate some task, using requests library can be pretty easy as we
#Dont have to bother about the headers which we send along with our call and lets us do things fast.
'''
Functions to send Simple get and post request along with payload
payload is a dictionary
cookie is also a dictionary of key value pair
'''
def get_request(payload, url, cookie):
r = requests.get(url, params=payload, cookies = cookie)
return r; # r.text gives exact text/html/json response which came from the server
def post_request(payload, url, cookie):
r = requests.post(url, data=payload, cookies = cookie)
return r; # r.text gives exact text/html/json response which came from the server