Sha256: 828a7ac5786c0ac408f7ecab400ad580a0b574f8250ef0a65babe85e8bccf96a

Contents?: true

Size: 570 Bytes

Versions: 5

Compression:

Stored size: 570 Bytes

Contents

require 'httpclient'
require 'json'
require 'nokogiri'
require 'open-uri'


def request_json_parse(url)
    body_dic={}

    client=HTTPClient.new()
    response=client.get(url)

    if response.status==200
     body_dic=JSON.parse(response.body)
    end

    return body_dic,response.status
 end


 def request_html_parse(url,opt)

    charset=nil
    status=[]
    response=open(url,opt) do |f|
        charset=f.charset
        status=f.status
        f.read
    end

    response_body=Nokogiri::HTML.parse(response,nil,charset)
    return response_body,status
 end
 

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
video_chat_get-0.1.4 lib/requests/request.rb
video_chat_get-0.1.3 lib/requests/request.rb
video_chat_get-0.1.2 lib/requests/request.rb
video_chat_get-0.1.1 lib/requests/request.rb
video_chat_get-0.1.0 lib/requests/request.rb