Radarly API的Python客户端
radarly-p的Python项目详细描述
Author: | Linkfluence |
---|---|
Version: | 1.0.10 |
这个包是一个python客户端,以便使用radarly api。多亏了 这个客户机,您可以获取 documentation。
安装
您可以使用pip安装此软件包。命令 pip install radarly-py将安装包及其所有依赖项。
注意
pandas不是radarly-py的依赖项,但它是强依赖项 建议用于探索存储量化数据的所有对象。
快速启动
首先,必须初始化一个api。
>>> from radarly import RadarlyApi >>> credentials = dict(client_id="XXXXX", client_secret="XXXXX") >>> RadarlyApi.init(**credentials) <RadarlyAPI.client_id=XXXXXXX>
然后,您可以使用 客户。
例如,你可以探索关于你的所有信息(你的项目, 你的设置…。
>>> from radarly.user import User >>> me = User.find(uid='me') >>> me <User.id=1.email='user.email@company.com'> >>> me.draw_structure(max_depth=1) User (User) | account_id (int) | apps (list[str]) | can_create_project (bool) | connected (int) | connection_count (int) | created (datetime) | current_project_id (int) | email (str) | engagement (dict) | id (int) | is_disabled (bool) | is_internal (bool) | is_manager (bool) | is_pending (bool) | is_root (bool) | level (str) | locale (str) | name (str) | picture_id (None) | projects (list[InfoProject]) | theme (str) | timezone (Europe/Paris) | updated (datetime)
然后,您可以探索一个特定的项目。
>>> from radarly.project import Project >>> my_project = Project.find(pid=2) >>> my_project <Project.pid=2.label=IGIT> >>> my_project.draw_structure(max_depth=1) Project (Project) | account_id (int) | alcmeon_company (str) | benchmark_entities (list[dict]) | brand_logos (list) | client_reference (str) | corpora (list[dict]) | created (datetime) | credentials (dict) | dashboards (list[Dashboard]) | docs_count (int) | docs_version (int) | flags (dict) | focuses (list[Focus]) | id (int) | industries (list[dict]) | label (str) | limits (dict) | milestones (list[dict]) | mm3_id (None) | out_of_reach_count (int) | picture_id (int) | platforms (list[str]) | project_manager_id (int) | renew (datetime) | research_manager_id (int) | sinaweibo_options (dict) | social_accounts (list[SocialAccount]) | social_wall_text (str) | start (datetime) | stop (datetime) | tags (list[Tag]) | total_indexed_docs_count (int) | updated (datetime) >>> my_project['$.focuses.id'][:5] # Top five focuses'id in the project [154262, 154263, 154374, 5, 140519]
现在可以获取存储在此项目中的一些出版物。例如,我们将 检索项目的五份出版物,2017年出版,并匹配 id为137622的查询(请参见project['focuses']以了解查询 你的项目)。
>>> from radarly.parameters import SearchPublicationParameter() >>> from datetime import datetime >>> start, end = datetime(2017, 1, 1), datetime(2017, 31, 12) >>> parameter = SearchPublicationParameter() \ .publication_date(start, end) \ .pagination(start=0, limit=5) \ .focuses(include=[137622]) >>> publications = project.get_publications(parameter) >>> publications [<Publication.uid='r3_prod_2-10...6268444865350'>, <Publication.uid='r3_prod_2-10...6268441960350'>, <Publication.uid='r3_prod_2-989433433368748032'>, <Publication.uid='r3_prod_2-10...6268434280350'>, <Publication.uid='r3_prod_2-10...6268433470350'>]
这个客户机为您提供了许多探索和导航的可能性 我们的API。请阅读API和 客户检查所有可能的情况。