I have a small python/flask application on Microsoft Azure, here: https://sdtflask.azurewebsites.net/#!/
This is being developed on my local machine and then pushed to GitHub where it automatically gets deployed to Azure. Everything works fine on both ends except for a tiny part of the app, which is a http request to the youtube API to retrieve some information from a youtube channel.
This works fine on my local machine, however when tried on Azure, it doesn't.
The code is the same on both ends:
import requests
from 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 as e:
print(str(e))
return {'message': 'something went wrong'}
Then I have the following:
from flask import Flask
from flask_restful import Api
from api.get_channel_list import GetChannelList
app = Flask(__name__)
api = Api(app)
api.add_resource(GetChannelList, "/api/get_channel_list")
import FlaskWebProject1.views
And then on my Angular controller I do the 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 my local machine:
But once I deploy to server, it doesn't load anything and this is what I get on the console's JSON:
I checked the application streaming logs and no errors are shown, there's also no python error, which makes me believe maybe azure blocks the request? Anyone has any idea what might be going on? Any pointers as to what I may do next will be appreciated. Thanks in advance