All Projects → ggabarrin → requestify

ggabarrin / requestify

Licence: MIT license
Parse a raw HTTP request and generate request code in different languages

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to requestify

Frequest
FRequest - A fast, lightweight and opensource desktop application to make HTTP(s) requests
Stars: ✭ 130 (+420%)
Mutual labels:  http-requests
direwolf
Package direwolf is a convenient and easy to use http client written in Golang.
Stars: ✭ 44 (+76%)
Mutual labels:  http-requests
SecurityHeaders GovUK
A scan of all .gov.uk sites for the most common security headers or lack of
Stars: ✭ 14 (-44%)
Mutual labels:  http-requests
Fitted
Simplifying http requests using ES decorators
Stars: ✭ 139 (+456%)
Mutual labels:  http-requests
EthernetWebServer SSL
Simple TLS/SSL Ethernet WebServer, HTTP Client and WebSocket Client library for for AVR, Portenta_H7, Teensy, SAM DUE, SAMD21, SAMD51, STM32F/L/H/G/WB/MP1, nRF52 and RASPBERRY_PI_PICO boards using Ethernet shields W5100, W5200, W5500, ENC28J60 or Teensy 4.1 NativeEthernet/QNEthernet. It now supports Ethernet TLS/SSL Client. The library supports …
Stars: ✭ 40 (+60%)
Mutual labels:  http-requests
restpect
Succint and readable integration tests over RESTful APIs
Stars: ✭ 83 (+232%)
Mutual labels:  http-requests
Linkcrawler
Find broken links in webpage
Stars: ✭ 102 (+308%)
Mutual labels:  http-requests
http interceptor
A lightweight, simple plugin that allows you to intercept request and response objects and modify them if desired.
Stars: ✭ 74 (+196%)
Mutual labels:  http-requests
pawn-requests
pawn-requests provides an API for interacting with HTTP(S) JSON APIs.
Stars: ✭ 56 (+124%)
Mutual labels:  http-requests
swish
C++ HTTP requests for humans
Stars: ✭ 52 (+108%)
Mutual labels:  http-requests
Vex
vex is a small PHP app that sends some load to a web application
Stars: ✭ 142 (+468%)
Mutual labels:  http-requests
Hargo
Hargo is a Go library and command line utility that parses HAR files, can convert to curl format, and serve as a load test driver.
Stars: ✭ 164 (+556%)
Mutual labels:  http-requests
FireMock
Mock and stub HTTP requests. Test your apps with fake data and files responses.
Stars: ✭ 25 (+0%)
Mutual labels:  http-requests
Chucker
🔎 An HTTP inspector for Android & OkHTTP (like Charles but on device)
Stars: ✭ 2,169 (+8576%)
Mutual labels:  http-requests
requester
The package provides a very thin wrapper (no external dependencies) for http.Client allowing the use of layers (middleware).
Stars: ✭ 14 (-44%)
Mutual labels:  http-requests
Agent orange
Parse and process User Agents like a secret one
Stars: ✭ 127 (+408%)
Mutual labels:  http-requests
1c http
Подсистема 1С для работы с HTTP
Stars: ✭ 48 (+92%)
Mutual labels:  http-requests
centra
Core Node.js HTTP client
Stars: ✭ 52 (+108%)
Mutual labels:  http-requests
node-fetch-har
Generate HAR entries for requests made with node-fetch
Stars: ✭ 23 (-8%)
Mutual labels:  http-requests
relay
Relay lets you write HTTP requests as easy to read, structured YAML and dispatch them easily using a CLI. Similar to tools like Postman
Stars: ✭ 22 (-12%)
Mutual labels:  http-requests

requestify

Requestify parses a raw HTTP request and generates source code in different languages (templates) that makes the parsed request.

Usage

First, clone the repo:

$ git clone https://github.com/ggabarrin/requestify.git
$ cd requestify

Then, install the dependencies:

$ pip install -r requirements.txt

Save the raw HTTP request you want to requestify in a file. Request should look similar to examples available on requestify/examples directory:

$ cat requestify/examples/get.txt
GET / HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
DNT: 1
Connection: keep-alive
Upgrade-Insecure-Requests: 1

Select the language for the script you want to generate from the available templates:

  • python: Python script using 'requests' module
  • php: PHP script
  • nodejs: Node.js script using 'request' module

Requestify!

python requestify/requestify.py -i <file> -l <language>

Examples

Parse GET request and generate python script

python requestify/requestify.py -i requestify/examples/get.txt -l python

Raw request:

GET / HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
DNT: 1
Connection: keep-alive
Upgrade-Insecure-Requests: 1

Generated python script:

import requests


# Headers
headers = {
    'Host': 'localhost:8080',
    'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
    'Accept-Language': 'en-US,en;q=0.5',
    'Accept-Encoding': 'gzip, deflate',
    'DNT': '1',
    'Connection': 'keep-alive',
    'Upgrade-Insecure-Requests': '1',
}

# Data
data = r''''''

# Cookies
cookies = {
}

# Prepare and send request
req = requests.Request(
    method='GET',
    url='http://localhost:8080/',
    headers=headers,
    data=data,
    cookies=cookies,
)
prepared_req = req.prepare()
session = requests.Session()
resp = session.send(prepared_req)
# print(resp.status_code)
# print(resp.text)
# print(resp.headers)

Parse POST request and generate node.js script

python requestify/requestify.py -i requestify/examples/post.txt -l nodejs

Raw request:

POST /login HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 44
Cookie: yummy_cookie=choco; tasty_cookie=strawberry
DNT: 1
Connection: keep-alive
Upgrade-Insecure-Requests: 1

user=the_user&password=super_secure_password

Generated nodejs script:

var request = require("request");

// headers
headers = {
  'content-length': '44',
  'accept-language': 'en-US,en;q=0.5',
  'accept-encoding': 'gzip, deflate',
  'host': 'localhost',
  'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  'user-agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0',
  'dnt': '1',
  'connection': 'keep-alive',
  'cookie': 'yummy_cookie=choco; tasty_cookie=strawberry',
  'upgrade-insecure-requests': '1',
  'content-type': 'application/x-www-form-urlencoded',
}

// cookies
var jar = request.jar();
jar.add(request.cookie('yummy_cookie=choco'));
jar.add(request.cookie('tasty_cookie=strawberry'));

// data
var data = `user=the_user&password=super_secure_password`;

// prepare and send request
request({
  uri: 'https://localhost:443/login',
  method: 'POST',
  headers: headers,
  body: data,
  jar: jar,
}, function(error, response, body) {
  // console.log(response.status_code);
  // console.log(body);
  // console.log(response.headers)
});

Contributing

We welcome contributions to requestify! These are the many ways you can help:

  • Submit patches and features
  • Report bugs
  • Add templates for your favorite languages

License

Requestify is licensed under a MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].