Skip to content
mojotoPublic

About

A native synchronous HTTP/1.1 client for Mojo with verified HTTPS, connection reuse, cookies, JSON, and streaming downloads.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Req.mojo logo

Req.mojo

A synchronous HTTP client for Mojo.

Test Documentation GitHub release

Language: English | 中文

Documentation: https://mojoto.github.io/req.mojo/

Installation

From a Pixi workspace already configured for Mojo, add the official Modular Community channel and install Req:

pixi workspace channel add --prepend https://repo.prefix.dev/modular-community
pixi add req

The community recipe is being submitted for review; these commands become available once the package is published to the channel. Req uses Mojo 1.1.0. Pixi installs the matching compiler, libcurl, and zlib, together with Req's precompiled module, CPU JSON modules, and native shared library. Req loads the native transport from the active Pixi environment automatically; no C build or extra linker flags are needed.

Usage

Save the following example as main.mojo in your workspace root:

import req


def main() raises:
    var response = req.get("https://example.com")
    response.raise_for_status()
    print(response.status_code)
    print(response.headers["Content-Type"])
    print(response.text())

Run the example:

pixi run mojo main.mojo

Or compile it and run the binary inside the Pixi environment:

pixi run mojo build main.mojo -o main
pixi run ./main

See the getting started guide for more examples and package integration.

Development

make install-hooks  # Install the pre-commit formatter (once per clone)
make test    # Run tests
make format  # Format code
make build   # Build the package

The hook runs make format before each commit. If formatting changes files, review and stage them, then commit again. It does not stage files automatically.

See the development guide for more commands and documentation setup.

Req is MIT licensed.

About

A native synchronous HTTP/1.1 client for Mojo with verified HTTPS, connection reuse, cookies, JSON, and streaming downloads.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages