写点什么

Windows Azure 已经使用 Python 包装

  • 2008-11-16
  • 本文字数:1518 字

    阅读完需:约 5 分钟

微软项目经理 Sriram Krishnan 已经为 Windows Azure 数据存储编写了一个 Python 包装。Python 是 Windows Azure 支持的语言之一。

根据微软的 Azure 网站,Python 是 Windows Azure 所支持的工具和语言之一:

Windows Azure 是一个开放的平台,将同时支持微软和非微软的语言和环境。Windows Azure 欢迎第三方的工具和语言,例如 Eclipse,Ruby,PHP 和Python…… 世界各地有数百万的开发人员使用.NET Framework 和 Visual Studio 开发环境。开发者可以用相同的技能使用 Visual Studio 创建云化的应用程序,直接使用 Visual Studio 编写,测试和部署。在不久的将来开发人员能够部署用 RubyOn Rails 和Python编写的应用程序。

Sriram 已经用 Python 编写了一个 Windows Azure 的数据存储包装并放在 GitHub 的代码库上。下面的例子演示了存储和查询数据:

复制代码
conn = WAStorageConnection(DEVSTORE_HOST, DEVSTORE_ACCOUNT, DEVSTORE_SECRET_KEY) <br></br>    for (container_name,etag, last_modified ) in  conn.list_containers(): <br></br>        print container_name <br></br>        print etag <br></br>        print last_modified <br></br>    conn.create_container("testcontainer", False) <br></br>    conn.put_blob("testcontainer","test","Hello World!" ) <br></br>    print conn.get_blob("testcontainer", "test")

下面的例子演示登录:

复制代码
def _get_auth_header(self, http_method, path, data, headers): <br></br>   # As documented at http://msdn.microsoft.com/en-us/library/dd179428.aspx <br></br>   string_to_sign =""
<p>#First element is the method <br></br>   string_to_sign += http_method + NEW_LINE</p>
<p>   #Second is the optional content MD5 <br></br>   string_to_sign += NEW_LINE</p>
<p>   #content type - this should have been initialized atleast to a blank value <br></br>   if headers.has_key("content-type"): <br></br>    string_to_sign += headers["content-type"] <br></br>   string_to_sign += NEW_LINE</p>
<p>   # date - we don't need to add header here since the special date storage header <br></br>   # always exists in our implementation <br></br>   string_to_sign += NEW_LINE</p>
<p>   # Construct canonicalized storage headers. <br></br>   # TODO: Note that this doesn't implement parts of the spec - <br></br>   # combining header fields with same name, <br></br>   # unfolding long lines and trimming white spaces around the colon <br></br>   ms_headers =[header_key for header_key in headers.keys() <br></br>   if header_key.startswith(PREFIX_STORAGE_HEADER)] <br></br>   ms_headers.sort() <br></br>   for header_key in ms_headers: <br></br>    string_to_sign += "%s:%s%s" % (header_key, headers[header_key], NEW_LINE)</p>
   # Add canonicalized resource <br></br>   string_to_sign += "/" + self.account_name + path <br></br>   utf8_string_to_sign = unicode(string_to_sign).encode("utf-8") <br></br>   hmac_digest = hmac.new(self.secret_key, <br></br>    utf8_string_to_sign, <br></br>    hashlib.sha256).digest() <br></br>   return base64.encodestring(hmac_digest).strip()

微软的 Windows Azure 计划看起来像是要超越 Google 所提供的。Google 的 App Engine 目前只支持 Python,但是 Google 在将来有支持多语言的计划

查看英文原文: Python Has Wrapped Itself Around Windows Azure

2008-11-16 19:521286
用户头像

发布了 45 篇内容, 共 85859 次阅读, 收获喜欢 1 次。

关注

评论

发布
暂无评论
发现更多内容

从零到部署:用 Vue 和 Express 实现迷你全栈电商应用(三)

图雀社区

vue.js Vue Node

做一个纸上谈兵的项目经理

escray

Sula - 可能是西湖区最好用的antd配置框架

开远

大前端 antd sula 配置化开发

中台上线半年,我总结出了“七宗罪”

punkboy

中台 企业中台 后台开发 业务中台 后台

csapp-chapter2

卓丁

深入理解计算机系统 csapp

ArrayList浅析

章小传

Java collection 原理 ArrayList

自定义 SpringBootStarter

子路无倦

愚蠢写作术(2):怎么让你的文章变得冷冰冰

史方远

学习 个人成长 写作

React之Context源码分析与实践

费马

源码分析 React useContext Context React-Router

从零到部署:用 Vue 和 Express 实现迷你全栈电商应用(四)

图雀社区

Vue Node

分布式事务 - 三种常见的解决方案

Java收录阁

分布式事务

GitHub上10个不可错过的另类有趣项目

码农神说

GitHub 开源 程序员

架构师必备的ToB产品交付之双轮驱动思维模型

常平

产品 极客大学架构师训练营

路径依赖 - 偶然决策导致的依赖。

石云升

思维模型 路径依赖 网络效应 沉没成本 价值网依赖

N皇后问题之位运算解法

孙苏勇

算法 DFS 位运算

多来点胜利,对冲颓丧

zhoo299

成长 备忘

源码分析 | 像盗墓一样分析Spring是怎么初始化xml并注册bean的

小傅哥

源码分析 小傅哥 spring源码 bean注入过程

JUC整理笔记五之梳理Varhandle(下)

JFound

Java

科学提升认知方法之贝叶斯公式

奈学教育

贝叶斯公式

大话设计模式 | 0 面向对象基础

Puran

C# 设计模式

重磅推出:第14份年度敏捷状态报告(最新2020)

Bob Jiang

敏捷 调查报告 state of agile

我的个人知识管理方法

lidaobing

个人成长 知识管理 PKM

从零到部署:用 Vue 和 Express 实现迷你全栈电商应用(六)

图雀社区

node.js Vue

JDK 15 都发布了,可 Java 8 依然是最爱

古时的风筝

Java Java 25 周年 Java版本

【译文】为什么说Rust是机器人技术的未来

袁承兴

rust 机器人 嵌入式

如何让解决无法访问 GitHub 的问题?

JackTian

GitHub

SpringCloud-OpenFeign源码

云淡风轻

Spring Cloud

从零到部署:用 Vue 和 Express 实现迷你全栈电商应用(五)

图雀社区

Vue Node

为什么你成不了「超级个体」?

非著名程序员

程序员 互联网 提升认知 认知提升

csapp-chapter1

卓丁

深入理解计算机系统 csapp

除了公关,我还能为公司做点什么?(系列1)

邓瑞恒Ryan

学习 个人成长 自我管理 成长 职业成长

Windows Azure已经使用Python包装_.NET_Abel Avram_InfoQ精选文章