Skip to content

Commit

Permalink
Merge pull request #10 from jpatrickdill/dev
Browse files Browse the repository at this point in the history
HTML/XML
  • Loading branch information
pat-dill authored Jun 7, 2020
2 parents 3efb55d + 5a27b95 commit 4dcd9b7
Show file tree
Hide file tree
Showing 8 changed files with 707 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
rojo.json
site/
web/robloxrequests/
.vscode
.vscode
.VSCodeCounter/
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ local r = http.get("https://api.github.com/orgs/Roblox/repos")
print(r.status_code, r.message)
-- 200 OK

repos = r:json()
local repos = r:json()
print(#repos)
-- 30

Expand All @@ -25,7 +25,7 @@ print(r.headers["x-ratelimit-remaining"])
-- 59
```

Roblox Requests will bring simple support for all internet resources to your game.
Roblox Requests will bring simple support for all internet resources to your game. [In this documentation](https://jpatrickdill.github.io/roblox-requests/guide/installation/) you'll find step-by-step instructions to get the most out of Roblox Requests.

## Features

Expand All @@ -41,6 +41,4 @@ Roblox Requests will bring simple support for all internet resources to your gam

Roblox Requests was inspired by the well known [Python Requests](https://2.python-requests.org/en/master/) library.

[In this documentation](https://jpatrickdill.github.io/roblox-requests/guide/installation/) you'll find step-by-step instructions to get the most out of Roblox Requests.

This project is MIT Licensed.
Binary file modified http.rbxm
Binary file not shown.
14 changes: 10 additions & 4 deletions http/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ local Src = script.src

------------------------------------------

local Promise = require(Lib.promise)
local html = require(Lib.html)

local Request = require(Src.request)
local Session = require(Src.session)
local Forms = require(Src.form)

local RateLimiter = require(Src.ratelimit)

------------------------------------------
Expand All @@ -33,9 +32,9 @@ function http.send(method, url, opts)
-- options (dictionary):
-- headers: (dictionary) Headers to send with request
-- query: (dictionary) Query string parameters
-- data: (str OR dictionary) Data to send in POST or PATCH request
-- data: (str | dictionary) Data to send in POST or PATCH request
-- log: (bool) Whether to log the request
-- cookies: (CookieJar OR dict) Cookies to use in request
-- cookies: (CookieJar | dict) Cookies to use in request

opts = opts or {}

Expand Down Expand Up @@ -71,6 +70,13 @@ function http.set_ratelimit(requests, period)
print("[http] RateLimiter settings changed: ", rl.rate, "reqs /", rl.window_size, "secs")
end

function http.parse_html(html_string, page_url)
return html.parse(html_string, 100000, page_url)
end

http.parse_xml = http.parse_html

http.stats = require(Src.stats)


return http
Loading

0 comments on commit 4dcd9b7

Please sign in to comment.