Giter Site home page Giter Site logo

req's Introduction

reQ

Anaconda-Server Badge Anaconda-Server Badge Build Status

HTTP requests library in kdb+/q

kdb+ has built in functions for HTTP requests such as .Q.hg (GET) and .Q.hp(POST). However, these functions are somewhat limited by several factors. For example, using these functions you cannot supply custom HTTP headers within the requests (for example, authorization tokens that are required by many APIs, a user agent etc.). In addition, in case of an HTTP redirect response, .Q.hg/.Q.hp will fail.

reQ is a library designed to overcome these limitations for basic HTTP queries. The main features are:

  • Custom headers
  • Automatic following of HTTP redirects
  • Automatic parsing of JSON responses to KDB+ object
  • Support for lower versions of KDB+ (tested on 2.7 & 3.3)
  • Cookie support

For more details on features & usage, please see the docs

Getting started

Standalone .q script

The simplest way for most people to get started with reQ will be via the standalone .q file available from the Releases tab of this repo. Download the .q script from the latest release & this can be loaded directly with \l when placed in project directory or QHOME etc.

q)\l req_0.1.3.q
q).req.g"https://httpbin.org/get"
args   | (`symbol$())!()
headers| `Accept`Host`User-Agent`X-Amzn-Trace-Id!("*/*";"httpbin.org";"kdb+/3..
origin | "90.249.33.209"
url    | "https://httpbin.org/get"

qutil package via Anaconda

Alternatively, reQ can be installed as a qutil via Anaconda/Miniconda

Assuming conda is installed, installation command is:

$ conda install -c jmcmurray req

And package will then be available in q via:

q).utl.require"req"

Standalone qutil package

If you want to use qutil package, but not via Anaconda, you can also download the package as a .tar.gz from the Releases tab & extract to your QPATH directory.

Updating documentation with qDoc

Using qDoc from Kx (included with Kx Developer)

$ # -norecurse so as not to go into ext/ dir
$ q $DEVELOPER_HOME/ws/qdoc.q_ -src req/ -out docs/api/ -norecurse
..
$ mkdocs serve # to preview locally
..
$ mkdocs gh-deploy # to deploy to github

Linting with qlint

Uses qlint.q_ from Kx (included with Kx Developer). Assumes DEVELOPER_HOME env var is set

$ q lint.q

Loads package & lints .req & related namespaces. Some errors/warnings excluded. Adding an additional arg on cmd line will halt process to inspect output table t.

Building releases

To build a release, build.sh is used. The script creates the unified, standalone .q script & the .tar.gz of qutil package.

Argument is version number e.g.

$ ./build.sh 0.1.3

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.