python - youtube api request on azure doesn't work -
i have small python/flask application on microsoft azure, here: https://sdtflask.azurewebsites.net/#!/
this being developed on local machine , pushed github automatically gets deployed azure. works fine on both ends except tiny part of app, http request youtube api retrieve information youtube channel.
this works fine on local machine, when tried on azure, doesn't.
the code same on both ends:
import requests flask_restful import resource class getchannellist(resource): def get(self): try: url = "https://content.googleapis.com/youtube/v3/search?key=aizasycxd3kgnnizy-omydh7u8lr3zgqd6zo448&channelid=ucvs6-k6ydmb4gh-kim3amja&part=snippet,id&order=date&maxresults=50" r = requests.get(url).json() # r.raise_for_status() return r except exception e: print(str(e)) return {'message': 'something went wrong'}
then have following:
from flask import flask flask_restful import api api.get_channel_list import getchannellist app = flask(__name__) api = api(app) api.add_resource(getchannellist, "/api/get_channel_list") import flaskwebproject1.views
and on angular controller following:
angular.module('sdt') .controller('mainctrl', function($scope, $http){ $scope.showresults = function(){ $scope.data = $http.get('api/get_channel_list').then(function(data){ console.log(data); $scope.printtable(data); }); } $scope.printtable = function(data){ $scope.pagetoken = data.data.nextpagetoken; // $scope.fetchmore($scope.pagetoken); $scope.items = data.data.items; } });
it works fine on local machine:
but once deploy server, doesn't load , on console's json:
i checked application streaming logs , no errors shown, there's no python error, makes me believe maybe azure blocks request? has idea might going on? pointers may next appreciated. in advance
maybe python requests throwing sslerror figure out why there sslexception
happening
looks the quickest fix setting verify=false
. (taken answer in link)
Comments
Post a Comment