Data update
This commit is contained in:
parent
35bcdeebf8
commit
74c69a0df6
2427 changed files with 31826 additions and 3468 deletions
|
|
@ -1,13 +1,12 @@
|
|||
require('HTTP::Tiny')
|
||||
|
||||
func get(url) {
|
||||
var lwp = (
|
||||
try { require('LWP::UserAgent') }
|
||||
catch { warn "'LWP::UserAgent' is not installed!"; return nil }
|
||||
)
|
||||
var ua = lwp.new(agent => 'Mozilla/5.0')
|
||||
if (var resp = ua.get(url); resp.is_success) {
|
||||
return resp.decoded_content
|
||||
static ua = %O<HTTP::Tiny>.new(agent => 'Mozilla/5.0')
|
||||
var resp = ua.get(url)
|
||||
if (resp{:success}) {
|
||||
return resp{:content}.decode_utf8
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
print get("http://rosettacode.org")
|
||||
say get("http://rosettacode.org")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue