Skip to main content

SunShareClient-数据服务接口包

shields_version shields_license shields_author shiedls_python

sunsharesymbol

介绍

  • SunShareClient是一个数据服务接口包,主要功能是提供数据服务的python-sdk,主要技术采用partial和getattr元编程技术。

安装

SunShareClient采用Python开发,得益于Python良好的社区环境,安装支持Pythonic风格的各种管理器。

	$ pip install sunshareclient-0.1-xxxxxxxxxxxx.whl

快速指南

客户端使用

  • 对于客户端,sunshare支持http协议的接口和python-sdk两种方式。

  • http接口使用 1.注册用户示例

	$ curl http://127.0.0.1:11911/user/register?user=test&password=123456

2.登录用户示例

	$ curl http://127.0.0.1:11911/user/login?user=test&password=123456

3.用户生成token示例

	$ curl http://127.0.0.1:11911/user/gen_token?user=test&token_key=7890

4.用户获取token示例

	$ http://127.0.0.1:11911/user/get_token?user=test&password=123456

5.用户调用数据接口示例(用户调用数据接口需要经过前提流程,注册用户-登录用户-生成token-使用token获取数据)

	$ http://127.0.0.1:11911/meteorological/get_wind_nwp_data_updated?token_key=7890&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NjU1Mzg0MzkuMTU3MTQzLCJ1c2VyIjoidGVzdCJ9.ZXdp688IIJgnFgSqgRx7rXBxYNK0LLDZTuQL_P09saE&entity=XJJX&start_time=2022-05-30,00:00:00&end_time=2022-06-01,00:00:00
  • python-sdk使用,以下是SunShareClient主程脚本代码示例:
from sunshareclient.client.api import DataAPI



### 设置除了token_key和token外,额外的参数
tmp_dict = {}
tmp_dict['entity'] = 'XJJX'
tmp_dict['start_time'] = '2022-05-30,00:00:00'
tmp_dict['end_time'] = '2022-06-01,00:00:00'
sunshareclient = DataAPI(token_key = 7890,
					token='eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2ODM1MzUyODIuMDA5NzE2NSwidXNlciI6InRlc3QifQ.gwhPIB_m4nAFGfIdSSdircknCQxQ82leyw8ylsTcdHs',
					timeout=6000)
# df = sunshareclient.query(dataapi='get_wind_nwp_data_updated_local',params=tmp_dict)
df = sunshareclient.get_wind_nwp_data_updated_local(params=tmp_dict)
# df = sunshareclient.get_wind_nwp_data_history_local(params=tmp_dict)
# df = sunshareclient.get_wind_measure_data_local(params=tmp_dict)
# df = sunshareclient.get_wind_turbine_data_local(params=tmp_dict)
print(df)

设计

  • 采用Client-Server架构设计

技术列表

  • 元编程技术-partial技术
  • 元编程技术-__getattr__技术

设计UML图

以下是设计的UML图: sunshareclientuml

Metadata

Release files for shihua-sunshareclient 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for shihua-sunshareclient 0.1.1
File Size Uploaded
shihua-sunshareclient-0.1.1.tar.gz 7.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for shihua-sunshareclient 0.1.1
File Interpreter ABI Platform
shihua_sunshareclient-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 15.8 kB

Release files / shihua-sunshareclient-0.1.1.tar.gz

Download URL shihua-sunshareclient-0.1.1.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0de3e79b990796209c8bbe00214ff8523b2ba4f81d3e4b2cfccf91c50aa91d9b
BLAKE2b-256 checksum
How to use checksums
a324d4a7a9476ce27c20bd5117a1a4eb0c9d3dff4f9be399db24ce6d785bded6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.12

Release files / shihua_sunshareclient-0.1.1-py3-none-any.whl

Download URL shihua_sunshareclient-0.1.1-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a31eba88458f363b23f17fb9725c4c9c81398b7753714e931e6adf9ac3531dbb
BLAKE2b-256 checksum
How to use checksums
3b8a4cd4151e04ffa37ee9dac67ce717f606b52826196759fdf81b92a38b868c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.12

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page