|Clay Shieh 8b97b556ab fixed logic for data conversion||8 months ago|
|.gitignore||8 months ago|
|LICENSE||8 months ago|
|README.md||8 months ago|
|requests.py||8 months ago|
A dependency free drop-in replacement for requests and requests-unixsocket for the common functions implemented using only Python 2 and 3 standard libraries.
I have a project where I use requests because that’s what everyone on stackoverflow tells me to do but I really only use simple GET/POST/PUT/DELETE functions.
I want to communicate with my Docker daemon but I think it’s ridiculous that I have to install requests AND requests-unixsocket just to send HTTP requests to a unix socket file.
I have a project where the only dependency is requests and/or requests-unixsocket and I don’t want to have to require users to install those just to use my project.
Well, if you find yourself thinking any of these when writing a project using request and/or requests-unixsocket then you should consider using this!
None, that’s the point.
requests.py into your project directory!
Features and usage are the same as requests quickstart for the following:
Unix socket usage is the same as requests-unixsocket documentation in regards to the scheme.
For example to send an HTTP request to
/var/run/docker.sock you would use:
r = requests.get("http+unix://%2Fvar%2Frun%2Fdocker.sock/info")
I only implemented a subset of the features in requests which I found myself most commonly using. If there is interest for more of requests features I will implement them or feel free to make a PR if you want to add it yourself!
Referenced https://github.com/docker/docker-py/blob/master/docker/transport/unixconn.py for Docker’s socket HTTPConnection code.
Pull requests and contributions are welcomed!
For any questions or concerns, please create an issue or contact me.