Giter Site home page Giter Site logo

httpie-http-signatures's People

Contributors

bobotig avatar labeneator avatar manuthu avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

httpie-http-signatures's Issues

Package doesn't seem to be python3 compliant

I have attempted to install this package on a py3 environment and I think that it's dependency: httpsig_cffi.sign.HeaderSigner->generate_message is not outputting the correct signature in py3.

Additionally, the sign body block for POST & PUT is not py3 compatible (it concats bytes & strings). Here's the correct block

 55         if sign_body:
 56             body = request.body or ""
 57             if "digest" not in request.headers:
 58                 m = hashlib.sha256(body.encode("utf-8"))
 59                 base64digest = base64.b64encode(m.digest())
 60                 base64string = base64digest.decode("utf-8")
 61                 request.headers["digest"] = 'SHA-256=' + base64string

Can't install httpie. Fails on httpsig_cffi.

Perhaps httpsig_cffi needs to be declared in setup.py?

 ❯ http --version
0.9.9

 ❯ pip install -U httpie-httpsig-auth 
Collecting httpie-httpsig-auth
  Using cached httpie-httpsig-auth-0.1.0.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/lmwangi/pip-build-_sAGel/httpie-httpsig-auth/setup.py", line 1, in <module>
        import httpie_httpsig_auth
      File "httpie_httpsig_auth.py", line 6, in <module>
        import httpsig_cffi.sign
    ImportError: No module named httpsig_cffi.sign

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/lmwangi/pip-build-_sAGel/httpie-httpsig-auth/

POST with JSON Body not working

What is the correct syntax for making a POST request with JSON body
echo '{"hello": "world"}' | http POST http://localhost:8080/ --auth-type=httpsig --auth 'username:password'
http: error: AttributeError: 'bytes' object has no attribute 'encode'
Same above command working fine with other httpie plugins like ntlm oauth etc

GET WORKS FINE
http GET http://localhost:8080/ --auth-type=httpsig --auth 'username:password'
HTTP/1.1 200
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Content-Type: application/json;charset=UTF-8
Date: Fri, 10 Jul 2020 10:50:53 GMT
Expires: 0
Pragma: no-cache
Transfer-Encoding: chunked
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block

{
"auth_details": "Signature keyId="username",algorithm="hmac-sha256",signature="bczfb2LsKFoqPxhx06r93QO122lR494e/9YsfeWg9yo=",headers="date (request-target) host"",
"body_info": null,
"host_info": "localhost:8080",
"id": 6,
"method_info": "GET",
"path_info": "/",
"protocol_info": "http",
"query_params": null
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.