+ 3

Problem with my django project

I was trying to create a django project. Everything was fine until I did a get request using requests.get() in python in my views.py Following is what my views.py have from django.http import HttpResponse from django.shortcuts import render import re, requests def codify_data(data_raw): data = data_raw.json()['data'] if language == 'web': html_cd = data['sourceCode'] css_cd = data['cssCode'] js_cd = data['jsCode'] def home_page(request): return render(request,'home/index.html') def code(request): link = request.GET.get('link', 'https://code.sololearn.com/c5I5H9T7viyb/?ref=app') result = re.search(r'https://code.sololearn.com/(.*)/?ref=app',link).group(1)[0:-2] data_raw = requests.get('https://api2.sololearn.com/v2/codeplayground/usercodes/'+result) codify_data(data_raw) Error link : 1) https://ibb.co/kypKMWd 2) https://ibb.co/t8ztWgz

11th Dec 2021, 9:44 AM
Ayush Kumar
Ayush Kumar - avatar
6 Answers
+ 1
The errors are showing that the Network is unreachable. So there should be a proxy protection on the network or you just don't have internet. For the first case: try to use another connection. For the second: you know what to do ... right ? :-) In my phone it seems to work very well.
11th Dec 2021, 5:17 PM
Ervis Meta
Ervis Meta - avatar
+ 1
Maybe you are getting this error because localhost is on http not https and the request is blocked from other side.
12th Dec 2021, 11:58 AM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
+ 1
丹ⓨㄩک廾 in your first screenshot the requested url is http://127.0.0.1/... ??
13th Dec 2021, 3:02 AM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
0
Hmm tried by changing proxy setting of my phone but it didn't worked Ervis Meta - SoloHelper Well it's working when I deploy the app on heroku 😧
12th Dec 2021, 6:43 AM
Ayush Kumar
Ayush Kumar - avatar
0
Nop AKSHAY🇮🇳 it's on https
12th Dec 2021, 2:13 PM
Ayush Kumar
Ayush Kumar - avatar
0
Hmm tried it but it says https is not supported AKSHAY🇮🇳
13th Dec 2021, 11:08 AM
Ayush Kumar
Ayush Kumar - avatar