Giter Club home page Giter Club logo

curl.jl's Introduction

Curl.jl

A little Julia client HTTP library. Curl.jl supports basic HTTP method usage (GET, POST, DELETE ...) for making requests to HTTP web servers.

Installation

  • Install Julia
  • From the Julia console Pkg.init() if not already done so
  • julia> Pkg.update(); Pkg.add("Curl"); using Curl

Examples

julia> using Curl

julia> using JSON

julia> Curl.get("http://jsonip.com").text
"{\"ip\":\"24.4.140.175\",\"about\":\"/about\"}"

julia> Curl.get("http://jsonip.com").headers[1]
9-element String Array:
 "HTTP/1.1 200 OK"                    
 "Server: nginx/1.2.6"                
 "Date: Sun, 24 Feb 2013 03:34:17 GMT"
 "Content-Type: application/json"     
 "Transfer-Encoding: chunked"         
 "Connection: keep-alive"             
 "Vary: Accept-Encoding"              
 "Access-Control-Allow-Origin: *"     
 "Access-Control-Allow-Methods: GET"  

julia> JSON.parse(Curl.get("http://jsonip.com").text)["ip"]
"24.4.140.175"

julia> Curl.post("http://requestb.in/181n1gk1", { :arg1 => "var1" }).text
"ok\n"

julia> Curl.delete("http://requestb.in/181n1gk1").text
"ok\n"

julia> Curl.head("http://requestb.in/181n1gk1").text
""

julia> Curl.get("http://nytimes.com").text[1:92]
"<!DOCTYPE html>\n<!--[if IE]><![endif]--> \n<html lang=\"en\">\n<head>\n<title>The New York Times "

julia> Curl.get("http://nytimes.com").headers[2]
12-element String Array:
 "HTTP/1.1 200 OK"                                                                                               
 "Date: Sun, 24 Feb 2013 03:36:02 GMT"                                                                           
 "Server: Apache"                                                                                                
 "expires: Thu, 01 Dec 1994 16:00:00 GMT"                                                                        
 "cache-control: no-cache"                                                                                       
 "pragma: no-cache"                                                                                              
 "Set-Cookie: RMID=007f0100629751298aa2003f; Expires=Mon, 24 Feb 2014 03:36:02 GMT; Path=/; Domain=.nytimes.com;"
 "Set-cookie: adxcs=-; path=/; domain=.nytimes.com"                                                              
 "Vary: Host"                                                                                                    
 "Content-Length: 168147"                                                                                        
 "Connection: close"                                                                                             
 "Content-Type: text/html; charset=UTF-8"  

julia> Curl.options("http://thestar.com.my").headers[1]
9-element String Array:
 "HTTP/1.1 200 OK"                        
 "Cache-Control: max-age=60"              
 "Allow: OPTIONS, TRACE, GET, HEAD, POST" 
 "Content-Length: 0"                      
 "Server: Microsoft-IIS/7.5"              
 "Public: OPTIONS, TRACE, GET, HEAD, POST"
 "X-Powered-By: ARR/2.5"                  
 "X-Powered-By: ASP.NET"                  
 "Date: Thu, 28 Feb 2013 01:28:42 GMT"    

julia> Curl.patch("http://requestb.in/s5sgk7s5", { :arg1 => "var1" }).text

julia> Curl.put("http://requestb.in/1cvo9dy1", { :arg1 => "var1", :arg2 => "var2" }).text

...

TODO

  • Curl-multi
  • Promises / callback interface

Requirements

  • libcurl

curl.jl's People

Contributors

pauladam avatar stuinzuri avatar westleyargentum avatar

Watchers

 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.