Problem with my django project | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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 Respostas
+ 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