All Projects → zonble → CurlDSL

zonble / CurlDSL

Licence: MIT license
CurlDSL converts cURL commands into URLRequest objects

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to CurlDSL

Websocat
Command-line client for WebSockets, like netcat (or curl) for ws:// with advanced socat-like functions
Stars: ✭ 3,477 (+6108.93%)
Mutual labels:  curl
flysystem-curlftp
Flysystem Adapter for the FTP with cURL implementation
Stars: ✭ 36 (-35.71%)
Mutual labels:  curl
Fetch
Asynchronous HTTP client with promises.
Stars: ✭ 29 (-48.21%)
Mutual labels:  curl
libpascurl
libPasCURL is delphi and object pascal wrapper around cURL library. Library for transferring data with URL syntax, supporting HTTP, HTTPS, FTP, FTPS, GOPHER, TFTP, SCP, SFTP, SMB, TELNET, DICT, LDAP, LDAPS, FILE, IMAP, SMTP, POP3, RTSP and RTMP.
Stars: ✭ 58 (+3.57%)
Mutual labels:  curl
Node.js-API-Masterclass-With-Express-MongoDB
[Brad Traversy] Node.js API Masterclass With Express & MongoDB [ENG, 2019]
Stars: ✭ 16 (-71.43%)
Mutual labels:  curl
curlall
Simple curl-like CLI tool to automatically page through APIs
Stars: ✭ 25 (-55.36%)
Mutual labels:  curl
Wttr.in
⛅ The right way to check the weather
Stars: ✭ 16,345 (+29087.5%)
Mutual labels:  curl
opencv3-setup
Raspberry Pi whiptail Menu driven Easy Install and Compile of opencv3 python from source files.
Stars: ✭ 47 (-16.07%)
Mutual labels:  curl
plz.el
An HTTP library for Emacs
Stars: ✭ 113 (+101.79%)
Mutual labels:  curl
cj
正方教务系统成绩查询手机版,结合Weui,自动识别验证码
Stars: ✭ 20 (-64.29%)
Mutual labels:  curl
TF2DeepFloorplan
TF2 Deep FloorPlan Recognition using a Multi-task Network with Room-boundary-Guided Attention. Enable tensorboard, quantization, flask, tflite, docker, github actions and google colab.
Stars: ✭ 98 (+75%)
Mutual labels:  curl
httpproxy
一个轻量级HTTP代理,支持shadowsocks服务,方便命令行、开发环境使用。
Stars: ✭ 90 (+60.71%)
Mutual labels:  curl
uva-tool
Command Line Based UVa OJ Submitting and uHunting Tool
Stars: ✭ 32 (-42.86%)
Mutual labels:  curl
Httpie
As easy as /aitch-tee-tee-pie/ 🥧 Modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more. https://twitter.com/httpie
Stars: ✭ 53,052 (+94635.71%)
Mutual labels:  curl
curl-worker
No description or website provided.
Stars: ✭ 42 (-25%)
Mutual labels:  curl
Covid19 Tracker Cli
A curl-based command line tracker for Novel Coronavirus or COVID-19 pandemic. It Supports terminal for linux and macos, command prompt for windows, and termux for android with real-time updates.
Stars: ✭ 244 (+335.71%)
Mutual labels:  curl
socks-cli
A solution to make CLI commands use socks5 proxy.
Stars: ✭ 48 (-14.29%)
Mutual labels:  curl
squirrel
Like curl, or wget, but downloads directly go to a SQLite databse
Stars: ✭ 24 (-57.14%)
Mutual labels:  curl
orca
C Multi-REST API library for Discord, Slack, Reddit, etc.
Stars: ✭ 360 (+542.86%)
Mutual labels:  curl
curlconverter
➰ ➡️ ➖ Translate cURL command lines into parameters for use with httr or actual httr calls (R)
Stars: ✭ 86 (+53.57%)
Mutual labels:  curl

CurlDSL

2019 © Weizhong Yang a.k.a zonble

Actions Status

CurlDSL converts cURL commands into URLRequest objects. The Swift package helps you to build HTTP clients in your iOS/macOS/tvOS easier, once you have a cURL command example for a Web API endpoint.

CurlDSL does not embed cURL library into your project. It is also not a Swift code generator, but it is a simple interpreter, it parses and interprets your cURL command at run time.

The project is inspired by cURL as DSL by Yoshiki Shibukawa.

CurlDSL supports only HTTP and HTTPS right now.

Requirement

  • Swift 5.1 or above
  • iOS 13 or above
  • macOS 10.15 or above
  • tvOS 13 or above

Installation

You can install the package via Swift Package Manager.

Usage

There is only one important object, CURL. You can just pass your cURL command to it. For example:

try CURL("curl -X GET https://httpbin.org/json")

You can use it to build URLRequest objects.

let request = try? CURL("curl -X GET https://httpbin.org/json").buildRequest()

Or jsut run the data task:

try CURL("https://httpbin.org/json").run { data, response, error in
    /// Do what you like...
}

Supported Options

We do not support all of options of cURL. The supported options are as the following list.

   -d, --data=DATA                         HTTP POST data (H)
   -F, --form=KEY=VALUE                    Specify HTTP multipart POST data (H)
       --form-string=KEY=VALUE             Specify HTTP multipart POST data (H)
   -H, --header=LINE                       Pass custom header LINE to server (H)
   -e, --referer=                          Referer URL (H)
   -X, --request=COMMAND                   Specify request command to use
       --url=URL                           URL to work with
   -u, --user=USER[:PASSWORD]              Server user and password
   -A, --user-agent=STRING                 User-Agent to send to server (H)

Built-in Response Handlers

The package has several built-in handlers:

  • JsonDictionaryHandler: Decodes fetched JSON data into a dictionary.
  • CodableHandler: Decodes fetched JSON data into Codable objects.
  • DataHandler: Simply returns raw data.

License

The package is released under MIT license.

Pull requests are welcome.

Enjoy!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].