GVKun编程网logo

[500]swiftclient操作(swift操作手册)

15

本文将带您了解关于[500]swiftclient操作的新内容,同时我们还将为您解释swift操作手册的相关知识,另外,我们还将为您提供关于(转载)Python工具包:PythonSwiftclien

本文将带您了解关于[500]swiftclient操作的新内容,同时我们还将为您解释swift操作手册的相关知识,另外,我们还将为您提供关于(转载)Python工具包:Python Swiftclient、AWESOME SWIFT-swift.libhunt.com-swift类库网站、clientLeft,clientWidth,clientX 等等、com.facebook.nifty.client.FramedClientConnector的实例源码的实用信息。

本文目录一览:

[500]swiftclient操作(swift操作手册)

[500]swiftclient操作(swift操作手册)

# encoding=utf-8
from keystoneauth1 import session
from keystoneauth1.identity import v3
from swiftclient import client,ClientException


OS_USERNAME = ''admin''
OS_USER_DOMAIN_NAME = ''Default''
OS_PASSWORD = ''123456''
OS_PROJECT_NAME = ''admin''
OS_PROJECT_DOMAIN_NAME = ''Default''
OS_AUTH_URL = ''http://192.169.113.11:35357/v3''

# Create a password auth plugin
auth = v3.Password(auth_url=OS_AUTH_URL,
                   username=OS_USERNAME,
                   password=OS_PASSWORD,
                   user_domain_name=OS_USER_DOMAIN_NAME,
                   project_name=OS_PROJECT_NAME,
                   project_domain_name=OS_PROJECT_DOMAIN_NAME)
# Create session
keystone_session = session.Session(auth=auth)
# Create swiftclient Connection
swift_conn = client.Connection(session=keystone_session)

# List the available containers (列出可用的容器)------------------------------
resp_headers, containers = swift_conn.get_account()
print("Response headers: %s" % resp_headers)
for container in containers:
    print(container)

# # List the available objects(列出可用对象)------------------------------
container = ''container-lsy''
resp_headers, objects = swift_conn.get_container(container)
print("Response headers: %s" % resp_headers)
for object in objects:
    print(object)

# # Create a new container(创建一个新容器)------------------------------
container = ''container-lsy2''
swift_conn.put_container(container)
resp_headers, containers = swift_conn.get_account()
if container in containers:
    print("The container was created")
for container in containers:
    print(container)

# # Create a new object with the contents of a local text file(创建具有本地文本文件内容的新对象)------------------------------
container = ''container-lsy''
with open(''data/123.pdf'', ''rb'') as local:
    swift_conn.put_object(
        container,
        ''123.pdf'',
        contents=local,
        content_type=''text/plain''
    )

## list object(列表对象)----------------------------------------
container = ''container-lsy''
resp_headers,body = swift_conn.get_object(container, ''123.pdf'')
print(resp_headers)

## Confirm presence of the object(确认物体的存在)------------------------------
obj = ''123.pdf''
container = ''container-lsy''
try:
    resp_headers = swift_conn.head_object(container, obj)
    print(''The object was successfully created'')
except ClientException as e:
    if e.http_status == ''404'':
        print(''The object was not found'')
    else:
        print(''An error occurred checking for the existence of the object'')

# # # Download the created object(下载创建的对象)------------------------------
resp_headers, obj_contents = swift_conn.get_object(container, obj)
with open(''local_copy.pdf'', ''wb'') as local:
    local.write(obj_contents)

# # Delete the created object(删除创建的对象) -------------------------------------
obj = ''123.pdf''
container = ''container-lsy''
try:
    swift_conn.delete_object(container, obj)
    print("Successfully deleted the object")
except ClientException as e:
    print("Failed to delete the object with error: %s" % e)

文档:https://ecloud.10086.cn/op-help-center/develop/Swift%20Python%20SDK.pdf

本文同步分享在 博客“周小董”(CSDN)。
如有侵权,请联系 support@oschina.cn 删除。
本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一起分享。

(转载)Python工具包:Python Swiftclient

(转载)Python工具包:Python Swiftclient

前言

Python Swiftclient 是一个用于 Swift API 的 Python 客户端。其中包含了 Python API(swift 模块)和一个命令行脚本(swift)。asdfadsfrt

原文来自:https://www.oschina.net/p/python-swiftclient

学习从来不是一个人的事情,要有个相互监督的伙伴,工作需要学习python或者有兴趣学习python的伙伴可以私信回复小编“学习” 获取资料,一起学习

AWESOME SWIFT-swift.libhunt.com-swift类库网站

AWESOME SWIFT-swift.libhunt.com-swift类库网站

https://swift.libhunt.com/categories/688-events

29 Events libraries and projects

  • ORDERED BY POPULARITY
  • ORDER BY DEV ACTIVITY
  •  ReactiveCocoa

      10.0   7.3  Objective-C
    ReactiveCocoa (RAC) is a Cocoa framework inspired by Functional Reactive Programming. It provides APIs for composing and transforming streams of values over time.
  •  RxSwift

      9.9   8.8 L3  Swift
    Microsoft Reactive Extensions (Rx) for Swift and iOS/OSX platform.
  •  PromiseKit

      9.8   8.7 L5  Swift
    async promise programming lib.
  •  ReSwift

      9.6   6.3 L5  Swift
    Unidirectional Data Flow in Swift
  •  Bond

      9.3   8.8 L1  Swift
    a Swift binding framework.
  •  BrightFutures

      8.3   4.7 L4  Swift
    promise and future lib for swift.
  •  Katana

      8.2  8.7 L4  Swift
    Swift apps a la React and Redux.
  •  ReactorKit

      7.8   6.4  Swift
    A framework for reactive and unidirectional application architecture.
  •  ReactKit

      7.4   0.0 L3  Swift
    Swift Reactive Programming.
  •  FutureKit

      6.4  0.7 L2  Swift
    A Swift based Future/Promises Library.
  •  SwiftEventBus

      6.4   3.2 L5  Swift
    A publish/subscribe event bus optimized for iOS.
  •  EmitterKit

      5.7  3.5 L5  Swift
    an implementation of event emitters and listeners in swift.
  •  Signals

      4.9   3.3 L5  Swift
    replaces delegates and notifications.
  •  Safe

      4.9   0.0 L2  Swift
    A modern concurrency and synchronization for Swift.
  •  snail

      4.5   7.1 L5  Swift
    An observables framework for Swift
  •  Reactor

      4.1   2.4 L5  Swift
    Powering your RAC architecture.
  •  VueFlux

      3.8  6.8  Swift
    Unidirectional Data Flow State Management Architecture
  •  SignalKit

      3.7   0.0 L5  Swift
    Swift event and binding framework.
  •  Observable

      3.7   6.2  Swift
    The easiest way to observe values.
  •  When

      3.4   5.4 L5  Swift
    A lightweight implementation of Promises in Swift.
  •  Caravel

      3.3   0.0 L2  Swift
    A Swift event bus for UIWebView and JS.
  •  Future

      2.5   0.0 L4  Swift
    A micro framework providing Future.
  •  NoticeObserveKit

      2.3   0.0 L5  Swift
    NoticeObserveKit is type-safe NotificationCenter wrapper that associates notice type with info type.
  •  Aftermath

      1.8   0.0 L5  Swift
    Stateless message-driven micro-framework in Swift.
  •  Notificationz

      1.6   2.5 L5  Swift
    Helping you own NSNotificationCenter by providing a simple, customizable adapter.
  •  Forbind

      1.2   0.0 L4  Swift
    Functional chaining and Promises in Swift.
  •  ReduxSwift

      1.0   0.0 L5  Swift
    Predictable state container for Swift apps too
  •  PureFutures

      0.7   0.0 L4  Swift
    Futures and Promises library.
  •  SSEventFlow

      0.3  4.4 L5  Swift
    A type safe alternative to NSNotification, inspired by Flux.

clientLeft,clientWidth,clientX 等等

clientLeft,clientWidth,clientX 等等

clientHeight   获取对象的高度,不计算任何边距、边框、滚动条,但包括该对象的补白。    
  clientLeft   获取   offsetLeft   属性和客户区域的实际左边之间的距离。    
  clientTop   获取   offsetTop   属性和客户区域的实际顶端之间的距离。    
  clientWidth   获取对象的宽度,不计算任何边距、边框、滚动条,但包括该对象的补白。    
  clientX   设置或获取鼠标指针位置相对于窗口客户区域的   x   坐标,其中客户区域不包括窗口自身的控件和滚动条。    
  clientY   设置或获取鼠标指针位置相对于窗口客户区域的   y   坐标,其中客户区域不包括窗口自身的控件和滚动条。    
  clip   设置或获取定位对象的哪个部分可见。    
  clipBottom   获取对象剪裁区域的底边坐标。    
  clipLeft   获取对象剪裁区域的左边坐标。    
  clipRight   获取对象剪裁区域的右边坐标。    
  clipTop   获取对象剪裁区域的顶边坐标。

com.facebook.nifty.client.FramedClientConnector的实例源码

com.facebook.nifty.client.FramedClientConnector的实例源码

项目:high    文件:TheAppClient.java   
public static void main(String[] args) throws ExecutionException,InterruptedException,illegalaccessexception,NoSuchMethodException,InvocationTargetException {
       ThriftClientManager clientManager = new ThriftClientManager();
       FramedClientConnector connector = new FramedClientConnector(new InetSocketAddress("localhost",8899));
       ThirdPartyCollectionService scribe = clientManager.createClient(connector,ThirdPartyCollectionService.class).get();
       //scribe.getAll();
       ThirdPartyCollection collection =
               new ThirdPartyCollection(1001,"2014-08-29");
       ThirdPartyCollection co2 = scribe.save(collection);
       System.out.println("c:"+ co2.getId());
       System.out.println("c:"+ co2.getDate());
}
项目:hadoop-EAR    文件:NNLatencyBenchmark.java   
/** Sets up clients before each benchmark */
private void setUp() throws Exception {
  try {
    fileSystem = (distributedFileSystem) FileSystem.get(
        StorageServiceConfigKeys.translatetoOldSchema(conf,nameserviceId),conf);
    InetSocketAddress nameNodeAddr = fileSystem.getClient().getNameNodeAddr();
    MetaInfo = new RequestMetaInfo(clusterId,nameserviceId,RequestMetaInfo.NO_NAMESPACE_ID,RequestMetaInfo.NO_APPLICATION_ID,(UnixUserGroupinformation) UserGroupinformation.getUGI(
        this.conf));

    directClientProtocol = RPC.getProxy(ClientProtocol.class,ClientProtocol.versionID,nameNodeAddr,conf);

    directClientProxyProtocol = RPC.getProxy(ClientProxyProtocol.class,ClientProxyProtocol.versionID,conf);

    clientManager = new ThriftClientManager();
    FramedClientConnector connector = new FramedClientConnector(HostAndPort.fromParts(
        proxyHostname,proxyPortThrift));
    proxyTClientProxyProtocol = clientManager.createClient(connector,TClientProxyProtocol.class)
        .get();

    proxyClientProxyProtocol = RPC.getProxy(ClientProxyProtocol.class,new InetSocketAddress(proxyHostname,proxyPortRPC),conf);

    fileSystem.mkdirs(new Path(ROOT));
  } catch (Exception e) {
    tearDown();
    throw e;
  }
}
项目:hadoop-EAR    文件:TestClientProxyService.java   
@Before
public void setUp() throws Exception {
  try {
    Configuration conf = new Configuration();
    // Bind ports automatically
    conf.setInt(StorageServiceConfigKeys.PROXY_THRIFT_PORT_KEY,0);
    conf.setInt(StorageServiceConfigKeys.PROXY_RPC_PORT_KEY,0);

    cluster = new MiniAvatarCluster(conf,2,true,null,1,true);
    fs = cluster.getFileSystem(0);

    MetaInfo = new RequestMetaInfo(conf.getInt(FSConstants.DFS_CLUSTER_ID,RequestMetaInfo.NO_CLUSTER_ID),cluster.getNameNode(0).getNameserviceId(),(UnixUserGroupinformation) UserGroupinformation.getUGI(conf));

    proxy = new ClientProxyService(new ClientProxyCommons(conf,conf.get(
        FSConstants.DFS_CLUSTER_NAME)));
    conf.setInt(StorageServiceConfigKeys.PROXY_THRIFT_PORT_KEY,proxy.getThriftPort());
    conf.setInt(StorageServiceConfigKeys.PROXY_RPC_PORT_KEY,proxy.getRPCPort());

    clientManager = new ThriftClientManager();
    FramedClientConnector connector = new FramedClientConnector(
        StorageServiceConfigKeys.getProxyThriftAddress(conf));
    clientThrift = clientManager.createClient(connector,TClientProxyProtocol.class).get();

    clientRPC = RPC.getProxy(ClientProxyProtocol.class,StorageServiceConfigKeys.getProxyRPCAddress(conf),conf);
  } catch (IOException e) {
    tearDown();
    throw e;
  }
}
项目:NeverwinterDP-Commons    文件:NiftyServerUnitTest.java   
private scribe.Client makeNiftyClient() throws TTransportException,InterruptedException {
  InetSocketAddress address = new InetSocketAddress("localhost",port);
  TTransport transport = new NiftyClient().connectSync(scribe.Client.class,new FramedClientConnector(address));
  TProtocol protocol = new TBinaryProtocol(transport);
  return new scribe.Client(protocol);
}

关于[500]swiftclient操作swift操作手册的介绍已经告一段落,感谢您的耐心阅读,如果想了解更多关于(转载)Python工具包:Python Swiftclient、AWESOME SWIFT-swift.libhunt.com-swift类库网站、clientLeft,clientWidth,clientX 等等、com.facebook.nifty.client.FramedClientConnector的实例源码的相关信息,请在本站寻找。

本文标签: