Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pcj/starlark-go-nethttp
http module for starlark-go
https://github.com/pcj/starlark-go-nethttp
go http starlark
Last synced: 3 months ago
JSON representation
http module for starlark-go
- Host: GitHub
- URL: https://github.com/pcj/starlark-go-nethttp
- Owner: pcj
- License: bsd-3-clause
- Created: 2018-12-06T16:17:45.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-09-27T06:48:47.000Z (over 4 years ago)
- Last Synced: 2024-06-19T15:12:30.311Z (7 months ago)
- Topics: go, http, starlark
- Language: Go
- Size: 10.7 KB
- Stars: 16
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-starlark - starlark-go-nethttp - a wrapper (Libraries and extensions)
- awesome-starlark - starlark-go-nethttp
README
# starlark-go-nethttp
A wrapper around a minimal subset of `net/http` package for use within
[starlark-go](https://github.com/google/starlark-go).## Documentation
* API documentation: [godoc.org/github.com/pcj/starlark-go-nethttp](https://godoc.org/github.com/pcj/starlark-go-nethttp)
### Getting started
Build the code:
```shell
# check out the code and dependencies,
# and install interpreter in $GOPATH/bin
$ go get -u github.com/pcj/starlark-go-nethttp
```Run the interpreter or interact with the read-eval-print loop (REPL):
```
$ nethttp
>>> resp = http.get("https://google.com")
>>> resp.code
200
>>>
```When you have finished, type `Ctrl-D` to close the REPL's input stream.
### Embedding
To embed the module within your own configuration language, add it to your globals:
```python
globals := starlark.StringDict{
"http": nethttp.NewModule(),
}
```### Contributing
Contributions welcome.