Last active
August 29, 2015 14:06
-
-
Save JogoShugh/55df12b8bc5630fd3cf2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace VersionOne.Utility.Functional | |
open System.Net | |
open System | |
open System.IO | |
open Newtonsoft.Json | |
open Newtonsoft.Json.Linq | |
module Web = | |
let FetchUrl url = | |
let req = WebRequest.Create(Uri(url)) | |
use resp = req.GetResponse() | |
use stream = resp.GetResponseStream() | |
use reader = new IO.StreamReader(stream) | |
reader.ReadToEnd() | |
let FetchJsonUrl url = | |
let content = FetchUrl url | |
JObject.Parse content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace VersionOne.Utility.Functional [ | |
open System.Net; | |
open System; | |
open System.IO; | |
open Newtonsoft.Json; | |
open Newtonsoft.Json.Linq; | |
module Web [ | |
let FetchUrl -url- = [ | |
let req = WebRequest.Create(Uri(url)); | |
use resp = req.GetResponse(); | |
use stream = resp.GetResponseStream(); | |
use reader = new IO.StreamReader(stream); | |
return reader.ReadToEnd(); | |
] | |
let FetchJsonUrl -url- = [ | |
let content = FetchUrl url; | |
return JObject.Parse content; | |
] | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment