almost 8 years ago
Hi All,
HTTP request is a two way process i..e client - server communication .Three basic features that make HTTP a powerful protocol and these are:
There are many type of request like :-
In this tutorial , we will use python to implement these request . Default libraries are used in this tutorial if you got an error of "No module name called 'requests' found " then use this command to install request library:-
import sys
import requests
import urllib
import json
url = 'PASTE HERE YOUR URL'
newConditions = {'email': 'test@test.com', 'password': '123123', 'device_token': '123456','device_type':'iOS'} # SET YOUR PARAMETERS FOR REQUEST
params = json.dumps(newConditions).encode('utf8')
req = urllib.request.Request(url, data=params,
headers={'content-type': 'application/json'})
response = urllib.request.urlopen(req)
raw_data = response.read()
encoding = response.info().get_content_charset('utf8') # JSON default
data = json.loads(raw_data.decode(encoding))
print(data)
import sys
import requests
import urllib
import json
url = 'PASTE HERE YOUR URL'
newConditions = {'email': 'test@test.com', 'password': '123123', 'device_token': '123456','device_type':'iOS'} # SET YOUR PARAMETERS FOR REQUEST
params = json.dumps(newConditions).encode('utf8')
req = urllib.request.Request(url, data=params,
headers={'content-type': 'application/json'})
response = urllib.request.urlopen(req)
raw_data = response.read()
encoding = response.info().get_content_charset('utf8') # JSON default
data = json.loads(raw_data.decode(encoding))
print(data)
#!/usr/bin/python3
import sys
import requests
import urllib
import json
url = 'PASTE YOUR GET URL HERE'
req = urllib.request.Request(url,
headers={'content-type': 'application/json'})
response = urllib.request.urlopen(req)
raw_data = response.read()
encoding = response.info().get_content_charset('utf8')
data = json.loads(raw_data.decode(encoding))
print(data)
#!/usr/bin/python3
import sys
import requests
import urllib
import json
url = 'PASTE YOUR GET URL HERE'
req = urllib.request.Request(url,
headers={'content-type': 'application/json'})
response = urllib.request.urlopen(req)
raw_data = response.read()
encoding = response.info().get_content_charset('utf8')
data = json.loads(raw_data.decode(encoding))
print(data)
0 Comment(s)