DEV Community

Vicente G. Reyes
Vicente G. Reyes

Posted on

[SOLVED]Using an external API in Django

Hi,

I'm trying to solve my issue with using an external API in django. Can anyone help me?

1

I'm trying to use an external API to grab data for my project to show on the template.

service.py

def get_data(title, url, description, body, datePublished):
  url = 'https://contextualwebsearch-websearch-v1.p.rapidapi.com/api/Search/WebSearchAPI'
    params = {"autoCorrect": "true", "pageNumber": "1", "pageSize": "10", "q": "police", "safeSearch": "true" }
    r = requests.get(url, params=params)
    data = r.json()
    article_data =

Latest comments (0)