I'm working on a project using Python(3.6) in which I need to implement GitHub API. I have tried by using JSON apis as:
from views.py:
class GhNavigator(CreateView):
def get(self, request, *args, **kwargs):
term = request.GET.get('search_term')
username = 'arycloud'
token = 'API_TOKEN'
login = requests.get('https://api.github.com/search/repositories?q=' + term, auth=(username, token))
print(login)
return render(request, 'navigator/template.html', {'login': login})
but it simply returns status 200, I want to get a list of repositories for term which is passed by the user.
How can I achieve that?
Help me, please!
Thanks in advance!
login.jsonto obtain the content packed into it.login.jsonit returns<bound method Response.json of <Response [200]>>.jsonis a function, so you should call it (i.e.login.json()).