Q:

how to send get request python

import requests
requests.get("https://www.google.com/")
5
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)
1
# importing the requests library 
import requests 
  
# api-endpoint 
URL = "http://maps.googleapis.com/maps/api/geocode/json"
  
# location given here 
location = "delhi technological university"
  
# defining a params dict for the parameters to be sent to the API 
PARAMS = {'address':location} 
  
# sending get request and saving the response as response object 
r = requests.get(url = URL, params = PARAMS) 
  
# extracting data in json format 
data = r.json()
-1

New to Communities?

Join the community