I am having the Python code for sending json Data and getting response can anyone heli in sending the JSON Data by using the android

  android, json
import requests
url = "https://ide.geeksforgeeks.org/main.php"
url1 = "https://ide.geeksforgeeks.org/submissionResult.php"
code = """
print("hello world hi")
"""
data = {
    "lang":"Python3",
    "code": """
            print("hello world hi")
            """,
"input":"0",
"save":"false"
       }
headers = {
'authority': 'ide.geeksforgeeks.org',
'accept': 'application/json, text/javascript, */*; q=0.01',
'x-requested-with': 'XMLHttpRequest',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like 
Gecko) 
Chrome/86.0.4240.75 Safari/537.36',
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
'origin': 'https://ide.geeksforgeeks.org',
'sec-fetch-site': 'same-origin',
'sec-fetch-mode': 'cors',
'sec-fetch-dest': 'empty',
'referer': 'https://ide.geeksforgeeks.org/',
'accept-language': 'en-IN,en-GB;q=0.9,en-US;q=0.8,en;q=0.7',
'cookie': '__ssds=2; __ssuzjsr2=a9be0cd8e; __uzmaj2=72fca303-e361-41b2-bba4-1589c25df78f; 
 __uzmbj2=1588696171; _ga=GA1.2.792984080.1588696178; _gac_UA-71763465- 
1=1.1596706783.CjwKCAjw1K75BRAEEiwAd41h1HmzsMxasGrGn- 
13gBVGu1OaFroH1MDb46tYX9CE5ps_QQQlLKtvMhoCuogQAvD_BwE; 
_gcl_aw=GCL.1596706783.CjwKCAjw1K75BRAEEiwAd41h1HmzsMxasGrGn- 
13gBVGu1OaFroH1MDb46tYX9CE5ps_QQQlLKtvMhoCuogQAvD_BwE; _fbp=fb.1.1596706785309.995420085; 
__qca=P0-1441563761-1597601442117; default_lang=java; 
__gads=ID=b869a834b05dc13e:T=1599318219:S=ALNI_Mb-bHiqdMBbpBaUp59Zh5cbcqOmMw; 
g_state=^{^^i_l^^:4,^^i_p^^:1602773797074^}; 
RT=^^z=1^&dm=geeksforgeeks.org^&si=8qiwp2gs6z9^&ss=kfvd39wa^&sl=0^&tt=0^^; 
__utma=245605906.792984080.1588696178.1601996864.1602142160.71; 
__utmz=245605906.1602142160.71.64.utmcsr=google^|utmccn=(organic)^|utmcmd=organic^|utmctr= 
(not^%^20provided); __uzmdj2=1602142123; __uzmcj2=98467103045590; 
_gid=GA1.2.546473506.1602435412; _gat=1; authtoken=dafd6e47aabe90f3743e98f08ae2de60; 
_gat_gtag_UA_144087254_1=1; G_ENABLED_IDPS=google',
}
r = requests.post(url, data=data)
r.json()`

And in this output, the only sid is taken and used for the next JSON response
Output:{‘status’: ‘SUCCESS’, ‘sid’: ‘cbc46c11a94ee0d58b7d89ced9978b91’}

requesttype = {
'sid': r.json()['sid'] ,
'requestType': 'fetchResults'
}
r1=requests.post(url1,headers=headers,data=requesttype)
r1.json()

Can anyone help using this in the android as I tried many but couldn’t find any proper result
and it may be the

Source: Android Questions

LEAVE A COMMENT