Git Product home page Git Product logo

ecnu-datasync-cli's Introduction

ecnu-datasync-cli

简介

ecnu-datasync-cli 是一个开源的轻量级工具,用于数据同步。它提供了一种灵活、快速、方便的方式,将数据同步至 csv 或 xlsx 文件。

优势

无需代码编写,只需要编写相关配置文件,即可通过命令行命令实现同步数据至文件。

用法

获取 ecnu-datasync-cli 安装程序可执行文件

  1. 获取可执行文件
  • 方法一:下载 ecnu-datasync-cli 可执行文件 Releases page

    下载解压后可直接使用。

  • 方法二:从源代码生成二进制文件

    git clone https://github.com/ECNU/ecnu-datasync-cli.git
    cd datasync-sdk-cli
    go build

    需要 go 1.20+ 环境
    win 环境下请自行添加 .exe 后缀

    生成的二进制文件在 datasync-sdk-cli 中

  1. 验证文件可用
    cd {PATH_TO_CLI}/datasync-sdk-cli
    ./ecnu-datasync-cli -v
    应输出版本信息

通过 ecnu-datasync-cli 同步数据到 csv 或 xlsx 文件

不使用配置文件进行同步

不使用配置文件进行同步时,直接在命令行中指定参数。

命令

请确保处于校园网环境或使用校园网VPN

./ecnu-datasync-cli -c {client_id} -s {client_secret} -a {api_path} -o {output_file}

-o 的值既可以填写 csv 文件也可以填写 xlsx 文件,会自动根据文件的后缀名来判断导出的类型

例子

使用配置文件进行同步

您还可以使用指定配置文件的方式进行数据同步。

如果同时指定了 -config 和其他参数,那么会忽略其他参数,仅以配置文件中的配置进行接口调用。

命令
./ecnu-datasync-cli -config {config_file}
例子
  1. 首先,在某目录 path_to_json 下创建一个示例配置文件 cfg.json ,并根据您的环境修改配置文件 cfg.json

       {
      "oauth2_config":{
        "client_id":"client_id",
        "client_secret":"client_secret",
        "base_url":"https://api.ecnu.edu.cn",
        "scopes":["ECNU-Basic"],
        "timeout":10,
        "debug":false
      },
      "api_config":{
        "api_path":"/api/v1/sync/fakewithts?ts=0",
        "page_size":2000
      },
      "output_file":"./test.csv"
    
    }
       ```

配置文件中,output_file 的值既可以填写 csv 文件也可以填写 xlsx 文件

  1. 然后,使用配置文件 path_to_json/cfg.json 中的配置进行数据同步。

    ./ecnu-datasync-cli -config path_to_json/cfg.json

ecnu-datasync-cli's People

Contributors

shijilin0116 avatar freedomkk-qfeng avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.