OSF的PythonAPI库
pythosf的Python项目详细描述
#pythosf
一个用于开放科学框架的快速python api客户端。(您最好使用[OSF客户端](https://github.com/osf client/osfclient)代替。)
示例用法:
``py
pythosf import client
pythosf.utils import bearer_token_auth
test_session=client.session(api_base_url=“https://staging api.osf.io/”,auth=bearer_token_auth(staging_token))
new_node=client.node(session=test_session).create(title=“quick test 4”)
child_node=new_node.create_child(title=“child test 1”)
打印(getattr(new_node,'title',none))
打印(getattr(child_node,'title',none))
打印(getattr(child_node,'date_modified',none))
child_node.delete(auth=bearer_token_auth(staging_token))
new_node.delete(auth=bearer_token_auth(staging_token))
some_project=client.node(session=test_session,id='9h533q')
providers=some_project.get_providers()
打印无))
my_provider=none
对于提供程序中的提供程序:
if provider.name==test_node_provider:
my_provider=provider
break
my_provider.get(retrieve_all=true)
files=my_provider.files
对于文件中的文件:
if file.name='1.png':
我的文件夹=文件
elif file.name='十':
我的文件夹=文件
我的文件.移动(到文件夹=我的文件夹,conflict='替换')
`````
一个用于开放科学框架的快速python api客户端。(您最好使用[OSF客户端](https://github.com/osf client/osfclient)代替。)
示例用法:
``py
pythosf import client
pythosf.utils import bearer_token_auth
test_session=client.session(api_base_url=“https://staging api.osf.io/”,auth=bearer_token_auth(staging_token))
new_node=client.node(session=test_session).create(title=“quick test 4”)
child_node=new_node.create_child(title=“child test 1”)
打印(getattr(new_node,'title',none))
打印(getattr(child_node,'title',none))
打印(getattr(child_node,'date_modified',none))
child_node.delete(auth=bearer_token_auth(staging_token))
new_node.delete(auth=bearer_token_auth(staging_token))
some_project=client.node(session=test_session,id='9h533q')
providers=some_project.get_providers()
打印无))
my_provider=none
对于提供程序中的提供程序:
if provider.name==test_node_provider:
my_provider=provider
break
my_provider.get(retrieve_all=true)
files=my_provider.files
对于文件中的文件:
if file.name='1.png':
我的文件夹=文件
elif file.name='十':
我的文件夹=文件
我的文件.移动(到文件夹=我的文件夹,conflict='替换')
`````