Skip to content

This is June Azure Camp code & hands on purpose repository

License

Notifications You must be signed in to change notification settings

CloudBreadPaPa/azure-camp-jun

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

azure camp jun

์ด repo๋Š” 2017๋…„ 6์›” ์˜ˆ์ •๋œ Azure dev camp 2์ผ์ฐจ PaaS ๊ณผ์ •์— ๋Œ€ํ•œ ์ฝ”๋“œ์™€ hands on ์ž๋ฃŒ๋ฅผ ์ œ๊ณต

Application ๊ฐœ๋ฐœ์„ ์œ„ํ•œ Azure App Service

Web App / API app / Mobile App ์ƒ์„ฑ๊ณผ ๋ฐฐํฌ

Demo : ์›น์•ฑ ์ƒ์„ฑ

Source control

//์ตœ์ดˆ ์‹คํ–‰์ผ ๊ฒฝ์šฐ email ๋ฐ nick์„ ์ž…๋ ฅํ•  ์ˆ˜ ์žˆ์Œ.
git init  
git add .  
git commit -m "initial commit"  
git remote add azure [URL for remote repository]  
git push azure master  
//์ฝ”๋“œ ์ˆ˜์ • ์ž‘์—… ํ›„  
git add .  
git commit -m "second commit"  
git push azure master  
//๋ฐฐํฌ ํ™•์ธ  

Github : https://azure.microsoft.com/en-us/documentation/articles/app-service-web-arm-from-github-provision/

repo๋ฅผ github์— ์ƒ์„ฑ  
Azure portal์—์„œ ์—ฐ์† ๋ฐฐํฌ ์„ค์ •  
์„ค์ • ํ›„ github์˜ repo๋ฅผ Azure Portal์—์„œ ์ง€์ •  

๋‹ค์–‘ํ•œ ์–ธ์–ด ์ง€์›

VS์—์„œ ASP.NET ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ  
๋นŒ๋“œ, ๋””๋ฒ„๊ทธ, ์‹คํ–‰  
์ƒ์„ฑ๋œ Project๋ฅผ VS์—์„œ ๊ฒŒ์‹œ ์ˆ˜ํ–‰  
index.php ์ƒ์„ฑ  
phpinfo() ์ฝ”๋“œ ์ถ”๊ฐ€  
WebMatrix ๋˜๋Š” git์„ ์ด์šฉํ•ด publish ์ˆ˜ํ–‰  
Web App ์„ค์ •์—์„œ php version ๋ฐ php ๊ด€๋ จ cofnig ์ˆ˜ํ–‰  
app.js ์ƒ์„ฑ  
console.log ์ฝ”๋“œ ์ถ”๊ฐ€  
git ๋“ฑ์„ ์ด์šฉํ•ด publish ์ˆ˜ํ–‰  
//todo  
//todo  

Demo : WebJobs

๋ฐฑ๊ทธ๋ผ์šด๋“œ์—์„œ ์ˆ˜ํ–‰๋˜๋Š” ์ž‘์—…์„ WebJob ์œผ๋กœ ์‹คํ–‰
https://azure.microsoft.com/en-us/documentation/articles/web-sites-create-web-jobs/

script๋กœ ์ˆ˜ํ–‰

// http://requestb.in/ ์‚ฌ์ดํŠธ๋ฅผ ์ด์šฉํ•ด webjob์„ inpection  
// req.php ํŒŒ์ผ ์ƒ์„ฑ  
<?php  
    $result = file_get_contents('http://requestb.in/๊ฒฝ๋กœ');  
    echo $result;  
?>  

// settings.job ํŒŒ์ผ ์ƒ์„ฑ  
{  
  "schedule": "0 */2 * * * *"  
}  

// ๋‘ ํŒŒ์ผ์„ zip์œผ๋กœ ๋ฌถ์€ ํ›„ webjob์œผ๋กœ ์—…๋กœ๋“œ  

C# ํ”„๋กœ์ ํŠธ๋กœ ๋ฐ๋ชจ ์ˆ˜ํ–‰

Deploy WebJobs using Visual Studio
https://azure.microsoft.com/en-us/documentation/articles/websites-dotnet-deploy-webjobs/

// demo\webjob-cs-with-webapp ํ”„๋กœ์ ํŠธ ์ฐธ์กฐ  
// console ํ”„๋กœ์ ํŠธ ๋˜๋Š” Azure WebJob ํ”„๋กœ์ ํŠธ ํ…œํ”Œ๋ฆฟ์œผ๋กœ ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ  
// ASP.NET web project ์ƒ์„ฑ ํ›„ ์ถ”๊ฐ€๋กœ console project ์ƒ์„ฑ  
// console project์—์„œ reqeustb.in์„ ์ด์šฉํ•ด ์š”์ฒญ ํ…Œ์ŠคํŠธ  
// Web rpoject์—์„œ console ํ”„๋กœ์ ํŠธ๋ฅผ webjob์œผ๋กœ ์ถ”๊ฐ€  
// Web App ๋ฐฐํฌ ์ˆ˜ํ–‰  

ํฌ๊ธฐ์กฐ์ ˆ ๋ฐ ํ…Œ์ŠคํŠธ

Web App ํฌ๊ธฐ์กฐ์ ˆ
https://azure.microsoft.com/en-us/documentation/articles/web-sites-scale/

// Web App์˜ App Service Plan๊ณผ ํฌ๊ธฐ์กฐ์ ˆ

์ฐธ๊ณ ์ •๋ณด : Pattern & Practice - Transient Fault Handling
https://msdn.microsoft.com/en-us/library/dn440719(v=pandp.60).aspx

Azure ๋ฐ์ดํ„ฐ ์ €์žฅ์†Œ(Azure Data Storage)

Azure blob ์ €์žฅ์†Œ

Azure Storage ๊ฐœ๋ฐœ์— ์œ ์šฉํ•œ Storage Explorer ๋„๊ตฌ ๋‹ค์šด๋กœ๋“œ http://storageexplorer.com/

Storage Exploerer ์„ค์น˜ ํ›„ Azure Portal์—์„œ ์ €์žฅ์†Œ ๊ณ„์ •(Storage Account)์˜ ์—‘์„ธ์Šค ํ‚ค - ์—ฐ๊ฒฐ๋ฌธ์ž์—ด์„ ๋„ฃ์œผ๋ฉด ํ•ด๋‹น ์ €์žฅ์†Œ ๊ณ„์ •์— Storage Explorer๋กœ ๋ฐ”๋กœ ์ ‘๊ทผ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

C# ์ฝ”๋“œ

์ฐธ๊ณ ๋งํฌ : https://azure.microsoft.com/en-us/documentation/articles/storage-dotnet-how-to-use-blobs/

public static void CreateContainer()
{
    // ์ €์žฅ์†Œ ์—ฐ๊ฒฐ ๋ฌธ์ž์—ด ์ฒ˜๋ฆฌ
    CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
        CloudConfigurationManager.GetSetting("StorageConnectionString"));

    // client ๊ฐœ์ฒด ์ƒ์„ฑ
    CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

    // ์ปจํ…Œ์ด๋„ˆ ๊ฐœ์ฒด ์ฐธ์กฐ
    CloudBlobContainer container = blobClient.GetContainerReference("mycontainer");

    // ์ปจํ…Œ์ด๋„ˆ๊ฐ€ ์—†์œผ๋ฉด ์ƒ์„ฑ
    container.CreateIfNotExists();

    return;
}

node.js

// ์•„๋ž˜ ๋งํฌ์—์„œ ์ •๋ณด ํ™•์ธ https://azure.microsoft.com/en-us/documentation/articles/storage-nodejs-how-to-use-blob-storage/

// ์„ค์น˜
// npm install azure-storage

// ํŒจํ‚ค์ง€ import ์ˆ˜ํ–‰
var azure = require('azure-storage');

// connection string ์ž‘์—… 
// environment variable์„ ๊ตฌ์„ฑ | Azure ์œ„์—์„œ ๊ตฌ์„ฑ๋„ ๊ฐ€๋Šฅ
var tableService = azure.createTableService('<์ €์žฅ์†Œ์ด๋ฆ„>', '<์ €์žฅ์†Œํ‚ค>');

// ํ…Œ์ด๋ธ” ์ƒ์„ฑ
tableService.createTableIfNotExists('nodetable', function(error, result, response) {
  if (!error) {
    // ์ˆ˜ํ–‰์™„๋ฃŒ
	console.log('ok');
	console.log(response);
  } else {
	  console.log(error);
  }
});

PHP

<?php
// composer๋ฅผ ์ด์šฉํ•ด PHP Azure client๋ฅผ ์„ค์น˜
// https://azure.microsoft.com/en-us/documentation/articles/storage-php-how-to-use-blobs/

require_once 'vendor\autoload.php';

use WindowsAzure\Common\ServicesBuilder;
use WindowsAzure\Blob\Models\CreateContainerOptions;
use WindowsAzure\Blob\Models\PublicAccessType;
use WindowsAzure\Common\ServiceException;

// https://azure.microsoft.com/en-us/documentation/articles/storage-php-how-to-use-blobs/

// Storage์˜ connection string ์ œ๊ณต
$connectionString = "DefaultEndpointsProtocol=http;AccountName=<์ €์žฅ์†Œ์ด๋ฆ„>;AccountKey=<์ €์žฅ์†Œํ‚ค>";

// REST proxy ์ƒ์„ฑ
$blobRestProxy = ServicesBuilder::getInstance()->createBlobService($connectionString);

$createContainerOptions = new CreateContainerOptions();

//setPublicAccess ์ ‘๊ทผ ์ •์ฑ… ์„ค์ •

// CONTAINER_AND_BLOBS:
// ์ „์ฒด ์—‘์„ธ์Šค ๊ถŒํ•œ
//
// BLOBS_ONLY:
// blob๋“ค์— ๋Œ€ํ•ด์„œ๋งŒ ์ฝ๊ธฐ ๊ถŒํ•œ. 
$createContainerOptions->setPublicAccess(PublicAccessType::CONTAINER_AND_BLOBS);

// ์ปจํ…Œ์ด๋„ˆ ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ ์„ค์ •
$createContainerOptions->addMetaData("VSTechUp", "Visual Studio");
$createContainerOptions->addMetaData("Azure", "Cloud");

try {
    // ์ปจํ…Œ์ด๋„ˆ ์ƒ์„ฑ
    $blobRestProxy->createContainer("phpcontainer", $createContainerOptions);
}
catch(ServiceException $e){
    // ์—๋Ÿฌ ํ•ธ๋“ค๋ง
    $code = $e->getCode();
    $error_message = $e->getMessage();
    echo $code.": ".$error_message."<br />";
}

?>

Azure table ์ €์žฅ์†Œ

C# ์ฝ”๋“œ

์ฐธ๊ณ ๋งํฌ : https://azure.microsoft.com/en-us/documentation/articles/storage-dotnet-how-to-use-tables/

// ์ €์žฅ์†Œ ์—ฐ๊ฒฐ ๋ฌธ์ž์—ด ์ฒ˜๋ฆฌ
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
    CloudConfigurationManager.GetSetting("StorageConnectionString"));

// table ํด๋ผ์ด์–ธํŠธ ๊ฐœ์ฒด ์ƒ์„ฑ
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();

// ํ…Œ์ด๋ธ” ์ฐธ์กฐ ์„ค์ • 
CloudTable table = tableClient.GetTableReference("people");

// ํ…Œ์ด๋ธ”์ด ์กด์žฌํ•˜์ง€ ์•Š์œผ๋ฉด ์ƒ์„ฑ
table.CreateIfNotExists();

node.js

// ์•„๋ž˜ ๋งํฌ์—์„œ ์ •๋ณด ํ™•์ธ https://azure.microsoft.com/en-us/documentation/articles/storage-nodejs-how-to-use-blob-storage/

// ์„ค์น˜
// npm install azure-storage

// ํŒจํ‚ค์ง€ import ์ˆ˜ํ–‰
var azure = require('azure-storage');

// connection string ์ž‘์—… 
// environment variable์„ ๊ตฌ์„ฑ | Azure ์œ„์—์„œ ๊ตฌ์„ฑ๋„ ๊ฐ€๋Šฅ
var tableService = azure.createTableService('<์ €์žฅ์†Œ๊ณ„์ •>', '<์ €์žฅ์†Œํ‚ค>');

// ํ…Œ์ด๋ธ” ์ƒ์„ฑ
tableService.createTableIfNotExists('nodetable', function(error, result, response) {
  if (!error) {
    // ์ˆ˜ํ–‰์™„๋ฃŒ
	console.log('ok');
	console.log(response);
  } else {
	  console.log(error);
  }
});

PHP

<?php
// https://azure.microsoft.com/en-us/documentation/articles/storage-php-how-to-use-table-storage/
require_once 'vendor\autoload.php';
//ini_set('display_errors', 1);
//error_reporting(~0);

use WindowsAzure\Common\ServicesBuilder;
use WindowsAzure\Common\ServiceException;

// Storage์˜ connection string ์ œ๊ณต
$connectionString = "DefaultEndpointsProtocol=http;AccountName=<์ €์žฅ์†Œ๊ณ„์ •>;AccountKey=<์–ด์นด์šดํŠธํ‚ค>";

// Azure์˜ table storage๋ฅผ ์œ„ํ•œ REST proxy ์ƒ์„ฑ
$tableRestProxy = ServicesBuilder::getInstance()->createTableService($connectionString);

/////////////////////////////////////////////////////////////////
// 01 ํ…Œ์ด๋ธ” ์ƒ์„ฑ
/////////////////////////////////////////////////////////////////
try {
    // ํ…Œ์ด๋ธ” ์ƒ์„ฑ
    $tableRestProxy->createTable("phptable");
}
catch(ServiceException $e){
    $code = $e->getCode();
    $error_message = $e->getMessage();
    echo $code.": ".$error_message."<br />";
}
?>

Azure queue ์ €์žฅ์†Œ

C# ์ฐธ๊ณ ๋งํฌ

https://azure.microsoft.com/en-us/documentation/articles/storage-dotnet-how-to-use-queues/

public static void CreateQueue()
{
    // ์—ฐ๊ฒฐ ๋ฌธ์ž์—ด ์ฒ˜๋ฆฌ
    CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
        CloudConfigurationManager.GetSetting("StorageConnectionString"));

    // ํ ํด๋ผ์ด์–ธํŠธ ๊ฐœ์ฒด ์ƒ์„ฑ
    CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();

    // ํ ์ฐธ์กฐ ์„ค์ •
    CloudQueue queue = queueClient.GetQueueReference("myqueue");

    // ํ๊ฐ€ ์—†์œผ๋ฉด ์ƒ์„ฑ
    queue.CreateIfNotExists();
}

node.js ์ฐธ๊ณ ๋งํฌ

https://azure.microsoft.com/en-us/documentation/articles/storage-nodejs-how-to-use-queues/

todo  

PHP ์ฐธ๊ณ ๋งํฌ

https://azure.microsoft.com/en-us/documentation/articles/storage-php-how-to-use-queues/

todo  

Azure files

์ฐธ๊ณ ๋งํฌ : https://azure.microsoft.com/en-us/documentation/articles/storage-dotnet-how-to-use-files/
์ฃผ์˜์‚ฌํ•ญ์œผ๋กœ, outbound 445 ๊ฐ€ ์—ด๋ ค ์žˆ์–ด์•ผ ํ•˜๋Š” ์ œํ•œ์ด ์žˆ์œผ๋ฉฐ, ISP์— ๋”ฐ๋ผ์„œ ๋‹ค๋ฆ„.

Azure SQL ๋ฐ์ดํ„ฐ ๋ฒ ์ด์Šค(SQL Database)

SQL Database

์†Œ๊ฐœ ๋ฐ ์ƒ์„ฑ
VS ๋˜๋Š” SSMS์—์„œ ์—ฐ๊ฒฐ
SQL Database vs VM

C# ์ฝ”๋“œ

์ฐธ๊ณ ๋งํฌ : https://msdn.microsoft.com/library/mt718320.aspx

using System;
using C = System.Data.SqlClient;

namespace azure_sql_cs
{
    class Program
    {
        static void Main(string[] args)
        {
            using (var connection = new C.SqlConnection(
                "Server=tcp:์„œ๋ฒ„๋ช….database.windows.net,1433;Initial Catalog=DB๋ช…;Persist Security Info=False;User ID=์œ ์ €์•„์ด๋””;Password=๋น„๋ฐ€๋ฒˆํ˜ธ;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
                    ))  // ์—ฐ๊ฒฐ ๋ฌธ์ž์—ด์„ ๋ณต์‚ฌํ•˜๊ณ  Azure SQL Database ์ƒ์„ฑ์‹œ ์ง€์ •ํ•œ user id์™€ pwd๋กœ ๋ณ€๊ฒฝ. ์„œ๋ฒ„๋ช…๊ณผ DB๋ช…์€ ์ž๋™์œผ๋กœ ์—ฐ๊ฒฐ ๋ฌธ์ž์—ด์— ์ง€์ •
            {
                connection.Open();
                Console.WriteLine("Connected successfully.");

                Console.WriteLine("Press any key to finish...");
                Console.ReadKey(true);
            }
        }
    }
}

PHP

์ฐธ๊ณ ๋งํฌ : https://msdn.microsoft.com/library/mt720665.aspx

<?php 
function OpenConnection()  
{  
	try  
	{  
		$serverName = "tcp:์„œ๋ฒ„๋ช….database.windows.net,1433";  
		$connectionOptions = array("Database"=>"DB๋ช…",  
			"Uid"=>"์œ ์ €์•„์ด๋””", "PWD"=>"๋น„๋ฐ€๋ฒˆํ˜ธ");  
		$conn = sqlsrv_connect($serverName, $connectionOptions);  
		if($conn == false)  
			die(FormatErrors(sqlsrv_errors()));  
	}  
	catch(Exception $e)  
	{  
		echo("Error!");  
	}  
}  
?>

node

์ฐธ๊ณ ๋งํฌ :
https://msdn.microsoft.com/library/mt715784.aspx
https://msdn.microsoft.com/library/mt652094.aspx

npm install tedious
var Connection = require('tedious').Connection;  
var config = {  
	userName: 'yourusername',  
	password: 'yourpassword',  
	server: 'yourserver.database.windows.net',  
	// If you are on Microsoft Azure, you need this:  
	options: {encrypt: true, database: 'AdventureWorks'}  
};  
var connection = new Connection(config);  
connection.on('connect', function(err) {  
// If no error, then good to proceed.  
	console.log("Connected");  
});  

Cosmos DB

์†Œ๊ฐœ
Cosmos DB overview: https://docs.microsoft.com/en-us/azure/cosmos-db/introduction

C# ์ฝ”๋“œ

์ฐธ๊ณ ๋งํฌ : https://docs.microsoft.com/en-us/azure/cosmos-db/create-documentdb-dotnet

node.js

์ฐธ๊ณ ๋งํฌ : https://docs.microsoft.com/en-us/azure/cosmos-db/create-documentdb-nodejs

HDInsight

์†Œ๊ฐœ
Hadoop tutorial: Get started using Hadoop in HDInsight on Windows
https://azure.microsoft.com/en-us/documentation/articles/hdinsight-hadoop-tutorial-get-started-windows/
Hadoop tutorial: Get started using Linux-based Hadoop in HDInsight
https://azure.microsoft.com/en-us/documentation/articles/hdinsight-hadoop-linux-tutorial-get-started/

Azure Machine Learning

Machine Learning ์†Œ๊ฐœ

Azure Machine Learning ์ฐธ๊ณ ๋งํฌ : https://azure.microsoft.com/en-us/documentation/services/machine-learning/

๋ชจ๋ธ ์ƒ์„ฑ

๊ธฐ๋ณธ ์ œ๊ณต๋˜๋Š” Adult census income ๋ฐ์ดํ„ฐ๋ฅผ ์ด์šฉํ•ด classification ML์„ ์ˆ˜ํ–‰ํ•˜๋Š” ๋ชจ๋ธ ์ƒ์„ฑ

ํ•™์Šต ๋ชจ๋ธ

ํ•„์š”ํ•œ property๋ฅผ ์„ ์ •ํ•ด traning ์‹œํ‚ค๊ณ  ๊ฒฐ๊ณผ๋ฅผ ๋„์ถœ

์„œ๋น„์Šค ์ƒ์„ฑ ๋ฐ API๋กœ ์‚ฌ์šฉ

๋…ธ์ถœ๋œ ML API๋ฅผ C#์ฝ”๋“œ, R ๋˜๋Š” Python์œผ๋กœ ํ™œ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•
C#, node.js + (Python) ์„ ์ด์šฉํ•œ Azure Machine Learning API ๋ฐ๋ชจ ์ฝ”๋“œ

์ด Repository๋Š” ๋ชจ๊ฐ์ฝ”x๋ชจ๋‘ ์•„ํ™‰๋ฒˆ์งธ ๋ชจ์ž„ ๋ฐœํ‘œ์— ์‚ฌ์šฉ๋œ demo ์ฝ”๋“œ. https://github.com/CloudBreadPaPa/mogakko-9th

C#์„ ์ด์šฉํ•œ Visual Studio ์‹คํ–‰ ์ ˆ์ฐจ

ml-demo\cs ํด๋”์—์„œ ํ”„๋กœ์ ํŠธ ์‹คํ–‰ ์ฝ”๋“œ์˜ API KKey๋ฅผ ์ž์‹ ์˜ Azure ML API Key๋กœ ์ˆ˜์ •

...
const string apiKey = "API Key"; // Azure ML์ด ์ œ๊ณตํ•˜๋Š” API Key
...
client.BaseAddress = new Uri("Azure ML์ด ์ œ๊ณตํ•˜๋Š” API URL");
...

node.js๋กœ ML API๋ฅผ ํ˜ธ์ถœํ•˜๋Š” ์ ˆ์ฐจ

ml-demo\node\app.js ํŒŒ์ผ์˜ API Key๋ฅผ ์ž์‹ ์˜ API Key๋กœ ์ˆ˜์ •

...
var host = 'asiasoutheast.services.azureml.net'	//์ œ๊ณตํ•˜๋Š” HOST ๊ฒฝ๋กœ
var path = 'HOST ์ดํ›„ URL Path ์ •๋ณด'
...
var api_key = 'API Key ์ •๋ณด'
...

node.js๋กœ Azure ML์„ call ์˜ˆ์ œ ๋งํฌ : https://blogs.msdn.microsoft.com/bigdatasupport/2016/02/18/how-to-call-a-azure-machine-learning-web-service-from-nodejs/

node reqeust package๋ฅผ ์ด์šฉํ•˜๋ฉด ๋” ์‰ฝ๊ฒŒ node์—์„œ Azure ML์„ ํ˜ธ์ถœ ๊ฐ€๋Šฅํ•  ๊ฒƒ์œผ๋กœ ์˜ˆ์ƒ๋จ. ์ฐธ๊ณ ๋งํฌ : https://github.com/request/request

Python์„ ์ด์šฉํ•œ Azure ML ํ˜ธ์ถœ ์ฝ”๋“œ

Python์„ ํ˜ธ์ถœํ•˜๊ธฐ ์œ„ํ•œ ๋ฐ๋ชจ ๊ธฐ๋ณธ code๋Š” Python 2.7.x ๊ธฐ์ค€. ์•„๋ž˜ ์ฝ”๋“œ ๋ฐ๋ชจ๋Š” ์•„๋งˆ๋„ ํ•œ๊ธ€๋กœ ์ธํ•ด unicode ์ฒ˜๋ฆฌ๊ฐ€ ํ•„์š”ํ•  ์ˆ˜ ์žˆ์Œ.

import urllib2
# If you are using Python 3+, import urllib instead of urllib2

import json 


data =  {

        "Inputs": {

                "input1":
                {
                    "ColumnNames": ["idx", "๋‚˜์ด", "ํ”„๋กœ๋ชจ์…˜์ฐธ์—ฌ์ˆ˜", "์‹๋ณ„์ž", "์ผํ‰๊ท ๊ฒŒ์ž„ํ”Œ๋ ˆ์ด๋ถ„", "90์ผ๋‚ด์•„์ดํ…œ๊ตฌ๋งค์ˆ˜", "๊ฒŒ์ž„๋ ˆ๋ฒจ๋ฒ”์œ„", "๋ณด์œ ํฌ๋ฆฌ์Šคํƒˆ", "์œ ์ž…๊ฒฝ๋กœ", "์ธ์ข…", "์„ฑ๋ณ„", "๊ฐ€์ž…์ฝ”๋“œ", "๊ตฌ๋งค๋ฒˆํ˜ธ", "์ฃผ๋‹น์ ‘์†์ˆ˜", "๊ฐ€์ž…๊ตญ๊ฐ€", "์ดํƒˆ์—ฌ๋ถ€"],
                    "Values": [ [ "0", "0", "0", "0", "0", "0", "0", "0", "value", "value", "value", "0", "0", "0", "value", "value" ], [ "0", "0", "0", "0", "0", "0", "0", "0", "value", "value", "value", "0", "0", "0", "value", "value" ], ]
                },        },
            "GlobalParameters": {
}
    }

body = str.encode(json.dumps(data))

url = 'AzureML์ด ์ œ๊ณตํ•˜๋Š” URL'
api_key = 'AzureML์ด ์ œ๊ณตํ•˜๋Š” APIKey' # Replace this with the API key for the web service
headers = {'Content-Type':'application/json', 'Authorization':('Bearer '+ api_key)}

req = urllib2.Request(url, body, headers) 

try:
    response = urllib2.urlopen(req)

    # If you are using Python 3+, replace urllib2 with urllib.request in the above code:
    # req = urllib.request.Request(url, body, headers) 
    # response = urllib.request.urlopen(req)

    result = response.read()
    print(result) 
except urllib2.HTTPError, error:
    print("The request failed with status code: " + str(error.code))

    # Print the headers - they include the requert ID and the timestamp, which are useful for debugging the failure
    print(error.info())

    print(json.loads(error.read()))

๋งˆ์ฐฌ๊ฐ€์ง€๋กœ, API Key ๋ณ€์ˆ˜๋ฅผ ์ž์‹ ์˜ Key๋กœ ๋ณ€๊ฒฝํ•˜๊ณ  ์ˆ˜ํ–‰ ํ•ด์•ผ ํ•จ.

...
url = 'AzureML์ด ์ œ๊ณตํ•˜๋Š” URL'
api_key = 'AzureML์ด ์ œ๊ณตํ•˜๋Š” APIKey' # Replace this with the API key for the web service
...

์ด๋ถ€๋ถ„์„ ๋ณ€๊ฒฝํ•˜๊ณ  ์ˆ˜ํ–‰

๋ฌธ์„œ์˜ ๋

About

This is June Azure Camp code & hands on purpose repository

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published