-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
94 additions
and
97 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,44 @@ | ||
|
||
# Roblox Requests 0.2.0 | ||
# Roblox Requests | ||
|
||
**Roblox Requests** brings user-friendly HTTP to Roblox with no need for the manual labor of HttpService. | ||
|
||
With Requests you can send robust, human-readable HTTP requests without ever having to deal with the underlying HttpService. | ||
No more manual query strings or encoding POST data. | ||
|
||
## Roblox Requests Features | ||
|
||
- Sessions with cookie persistence, base URLs/headers | ||
- Automatic query string building | ||
- Automatic JSON body encoding | ||
- Builtin Response object and JSON decoding | ||
- Domain based Key/Value cookies | ||
- Multipart form building including file encoding and upload | ||
- Global ratelimiting with per-session config options | ||
|
||
--- | ||
|
||
An example of what you can do with Requests: | ||
#### The Power of Roblox Requests: | ||
|
||
```lua | ||
local http = require(game.ReplicatedStorage.http) | ||
local r = http.get("https://api.github.com/orgs/Roblox/repos") | ||
|
||
local r = http.post("https://httpbin.org/post", { | ||
query = {arg="value"}, | ||
data = {this="json"} | ||
}) | ||
print(r.status_code, r.message) | ||
-- 200 OK | ||
|
||
print(r.content_type, | ||
r:json().url) | ||
repos = r:json() | ||
print(#repos) | ||
-- 30 | ||
|
||
-- output: | ||
print(r.content_type) | ||
-- application/json | ||
-- https://httpbin.org/post?arg=value | ||
print(r.encoding) | ||
-- utf-8 | ||
print(r.headers["x-ratelimit-remaining"]) | ||
-- 59 | ||
``` | ||
|
||
See [similar code with HttpService.](https://gist.github.com/jpatrickdill/8fe2a82c47c1bdf679eb1a1c5f07d7a0) | ||
Roblox Requests will bring simple support for all internet resources to your game. | ||
|
||
## Features | ||
|
||
Requests' powerful API allows you to send HTTP/1.1 requests without the need of manual labor. You'll never | ||
have to add query strings to URLs or encode your POST data again. | ||
- Sessions with Cookie Persistence | ||
- Default Headers, URL prefixes | ||
- Automatic Query Strings | ||
- JSON Body Encoding, JSON Response Decoding | ||
- Elegant Key/Value Cookies | ||
- Domain/Path filters | ||
- Multipart File Encoding and Upload | ||
- Global/Per-Session Ratelimiting | ||
|
||
|
||
## [Documentation](https://jpatrickdill.github.io/roblox-requests/guide/installation/) | ||
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "roblox-requests", | ||
"tree": { | ||
"$className": "DataModel", | ||
|
||
"ReplicatedStorage": { | ||
"$className": "ReplicatedStorage", | ||
|
||
"http": { | ||
"$path": "http" | ||
} | ||
} | ||
} | ||
} |
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
This file was deleted.
Oops, something went wrong.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
local HttpService = game:GetService("HttpService") | ||
|
||
local body = HttpService:JSONEncode({cookies = "milk"}) | ||
local r = HttpService:RequestAsync({Url = "https://httpbin.org/put", Method="PUT", Body=body}) | ||
|
||
if r.Success then | ||
data = HttpService:JSONDecode(r.Body) | ||
end |
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
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
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