import requests
import json
url = "https://proxy6.net/api/xxx"
def descr():
return 88
querystring = {"descr":descr()}
headers = {
'Cache-Control': "no-cache",
'Postman-Token': "xxx"
}
response = requests.request("GET", url, headers=headers, params=querystring)
response = response.json()
print(response['list']['xx']['host'])
print(response['list']['xx']['port'])
Explanations:
{"status":"yes","user_id":"xx","balance":"xx","currency":"xx","list_count":1,"list":{"xx":{"id":"xx","version":"x,"ip":"xx","host":"xx","port":xx","user":"xx","pass":"xx","type":"socks","country":"us","date":"2018-09-05 22:00:22","date_end":"2018-10-05 22:00:22","unixtime":1536174022,"unixtime_end":1538766022,"descr":"88","active":"1"}}}
response['list'] gives `{"xx":{"id":"xx","version":"x,"ip":"xx","host":"xx","port":xx","user":"xx","pass":"xx","type":"socks","country":"us","date":"2018-09-05 22:00:22","date_end":"2018-10-05 22:00:22","unixtime":1536174022,"unixtime_end":1538766022,"descr":"88","active":"1"}}`
response['list']['xx'] gives `{"id":"xx","version":"x,"ip":"xx","host":"xx","port":xx","user":"xx","pass":"xx","type":"socks","country":"us","date":"2018-09-05 22:00:22","date_end":"2018-10-05 22:00:22","unixtime":1536174022,"unixtime_end":1538766022,"descr":"88","active":"1"}`
response['list']['xx']['host'] gives host key value
response['list']['xx']['port'] gives port key value
Do let me know if you have doubts
{"status":"yes","user_id":"xx","balance":"xx","currency":"xx","list_count":1,"list":{"xx":{"id":"xx","version":"x,"ip":"xx","host":"xx","port":xx","user":"xx","pass":"xx","type":"socks","country":"us","date":"2018-09-05 22:00:22","date_end":"2018-10-05 22:00:22","unixtime":1536174022,"unixtime_end":1538766022,"descr":"88","active":"1"}}}