用于incf数字地图册基础设施的python api

incf.dai的Python项目详细描述


发现和访问集线器

简而言之,印加国防部的DAI由一个所谓的网络组成 中心 提供管理中心的集团决定的任何服务 分享。要发现可用的集线器,有一个实用功能

>>> from incf.dai.utils import list_hub_names
>>> sorted(list_hub_names())
['aba', 'central', 'emap', 'ucsd', 'whs']

这提供了当前已知集线器名称的列表。(注:ATM列表 由包提供,因为管理 注册表仍然是一个快速移动的目标。)

知道可用集线器的名称可以选择代理对象 通过调用特定的集线器

>>> from incf.dai.utils import get_hub_by_name
>>> whs = get_hub_by_name('whs')
>>> whs # doctest: +ELLIPSIS
<incf.dai.hub.HubProxy object at ...>

如果您呼叫未知集线器(或输入错误),您将收到一个 键错误

>>> foo = get_hub_by_name('foo')
Traceback (most recent call last):
KeyError

对于内省,此集线器的服务控制器的url是 可用作

>>> whs.base_url
'http://incf-dev-local.crbs.ucsd.edu/whs/atlas?service=WPS'

所有集线器都应提供两种方法:

>>> whs.GetCapabilities  # doctest: +ELLIPSIS
<bound method HubProxy.GetCapabilities of ...>
>>> whs.DescribeProcess # doctest: +ELLIPSIS
<bound method HubProxy.DescribeProcess of ...>

调用这些方法中的任何一个都将返回自定义响应对象

>>> response = whs.GetCapabilities()
>>> response  # doctest: +ELLIPSIS
<incf.dai.response.Response object at 0x...>
>>> response = whs.DescribeProcess()
>>> response  # doctest: +ELLIPSIS
<incf.dai.response.Response object at 0x...>

通常,不需要调用上述两个方法中的任何一个 以上是他们返回的主要信息,可通过

>>> sorted(whs.capabilities)
[u'DescribeSRS', u'GetStructureNamesByPOI', u'ListSRSs', u'ListTransformations', u'TransformPOI']

所有列出的方法都可以立即在hub代理上使用

>>> from incf.dai.utils import list_hub_names
>>> sorted(list_hub_names())
['aba', 'central', 'emap', 'ucsd', 'whs']
0

喜欢in

>>> from incf.dai.utils import list_hub_names
>>> sorted(list_hub_names())
['aba', 'central', 'emap', 'ucsd', 'whs']
1
>>> from incf.dai.utils import list_hub_names
>>> sorted(list_hub_names())
['aba', 'central', 'emap', 'ucsd', 'whs']
2

为了进一步方便,响应对象还支持如下属性 访问数据,如

>>> from incf.dai.utils import list_hub_names
>>> sorted(list_hub_names())
['aba', 'central', 'emap', 'ucsd', 'whs']
3

请注意如何将命名空间保留为键和属性名称的前缀。

省略必需的参数会引发 applicationerror

>>> from incf.dai.utils import list_hub_names
>>> sorted(list_hub_names())
['aba', 'central', 'emap', 'ucsd', 'whs']
4

而正确地调用一个方法会给出适当的响应(希望如此)

>>> from incf.dai.utils import list_hub_names
>>> sorted(list_hub_names())
['aba', 'central', 'emap', 'ucsd', 'whs']
5

这里的 格式=无 http://code.google.com/p/incf-dai/issues/detail?id=14

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
Gson类中的java验证错误   If和elseif之间的java差异?   字典Java8地图。输入比较器   java连接到远程计算机以获得WMI支持   java如何使用改型处理JSON对象中的空值   在Java中使用Comparator时不可编译的源代码   java将Jar添加到JSP的运行时路径   带有随机对象的while循环的java大O时间复杂性   java可以在不考虑参数的情况下模拟方法吗?   java我有一个简单的代码,它不工作。无法修复错误“println”   向eclipse添加Xively java库   java是否可以启用本机代码的缓存?   全局变量如何在Java中的所有类之间共享要使用的语言环境?   Java内存游戏如何翻转单个卡?