cdstar api的python包装器

pycdstar的Python项目详细描述


PycdStar

用于cdstar的python客户端库

Build StatusPyPIcodecov.io

用法

frompycdstar.apiimportCdstar# Initialize a client object, with connection info from a config filecdstar=Cdstar()# create a new objectobj=cdstar.get_object()# with initially no associated metadataassertobj.metadataisNone# assigning to the metadata property will create a metadata recordobj.metadata={"creator":"pycdstar"}# retrieve the now existing objectobj=cdstar.get_object(obj.id)assert'creator'inobj.metadata# again, initially the bitstreams property is an empty listassertnotobj.bitstreams# we add a bitstream by uploading a local filebitstream=obj.add_bitstream(fname='README.txt')# and re-read the objectobj.read()# a bitstreams read method returns an iterator to allow for streaming,# i.e. chunked downloadsassert''.join(list(bitstream.read()))assertlen(obj.bitstreams)==1# to make sure the newly created resources are properly indexed, we allow# for a short delaysleep(1)# now we search for a string we know to exist in the uploaded bitstreamres=cdstar.search('ssh')assertlen(res)# the first element in the search results list has the bitstream as# associated resourceassert'ssh'in''.join(list(res[0].resource.read()))query='pycdstar'res=cdstar.search(query,index='metadata')assertlen(res)res=cdstar.search(query,index='fulltext')assertnotlen(res)bitstream.delete()obj.delete()

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

推荐PyPI第三方库


热门话题
试图读取字段“java”。lang.反对安卓。util。一对首先   gradle对java的影响。属性作为任务的输入?   java我的return语句不起作用。我做错了什么?   java通用同步代码块[无对象锁定]   macos Java小程序游戏不能在Mac上运行,即使它可以在PC上运行   java Firebase GeoFire设置位置未在服务中工作   java排序字符串对象   java通过JLabel上传背景图像(jpg)后,如何将图像缩放到它所在的面板上?   java无法连接到jsp中的数据库   java如何在整个ant taskdef操作的执行过程中拥有一个singleton类实例   java如何在按键事件中检查JTtextField中的字符串数字验证器   如何最好地输出大型单行XML文件(使用Java/Eclipse)?   内存不足,Java运行时环境无法在Java应用程序中继续运行   java Hibernate连接错误:组织上的NullPointerException。冬眠hql。阿斯特。HqlSqlWalker。createFromJoinElement   linux将参数从shell脚本传递到java类   java对于接受多个参数的setter是否有类似于@JsonCreator的注释?   java在链表中添加节点