CryptoControl - Python 加密新闻 API 在 Python Django 中的集成

CryptoControl - Python Crypto News API Integration in Python Django

我的代码是--

from django.shortcuts import render

from crypto_news_api import CryptoControlAPI

def index(request):

   api = CryptoControlAPI("i have entered my api key")  

   api.enableSentiment()

   # Get top news
   topNews = api.getTopNews(language = "en")
   print(topNews)
   #return render(request, 'index.html',{"data":topNews})

我正在 django 中集成 CryptoControl - Python 加密新闻 API 但我收到此错误:

Bad response from the CryptoControl API
Request Method: GET
Request URL:    http://127.0.0.1:8000/
Django Version: 2.2.3
Exception Type: Exception
Exception Value:    
Bad response from the CryptoControl API
Exception Location: C:\Users\sachin.parashar\Envs\newsbit\lib\site-packages\crypto_news_api\__init__.py in _fetch, line 28
Python Executable:  C:\Users\sachin.parashar\Envs\newsbit\Scripts\python.exe
Python Version: 3.7.3

任何人都可以帮助我解决这个问题,因为我是 python 使用 django 框架的新手。 我还安装了 -- pip install crypto-news-apipip install requests.

您可以使用:

data= requests.get("__You URL__")
data_content= json.loads(data.content)
return render(request, '__you template here__', 'data':data_content})