smilli / py-corenlp

Python wrapper for Stanford CoreNLP
353 stars 75 forks source link

Add Basic Authentication? #25

Open aendra-rininsland opened 7 years ago

aendra-rininsland commented 7 years ago

According to the docs you can provide a -username and -password flag to CoreNLP to get it to use Basic Authentication for requests. Would it be possible to support this in py-corenlp? I have a microservice architecture using CoreNLP that bridges between AWS and Heroku, so therefore can't use Security Groups and have to fall back on whatever auth CoreNLP provides.

saikishor commented 6 years ago

I guess we can do the same with small modification please refer to this : http://docs.python-requests.org/en/latest/user/quickstart/#more-complicated-post-requests

aendra-rininsland commented 6 years ago

Hi!

I don't think any access is provided to the StanfordCoreNLP class' headers; it's explicitly provided as "connection: close" here: https://github.com/smilli/py-corenlp/blob/master/pycorenlp/corenlp.py#L29

If that was possible, then it'd be easy to just pass an Authorization header. TBTH though, it still really would make the most sense as a some sort of configuration parameter, maybe a kwarg — one generally shouldn't have to figure out whatever authentication mechanism being used by a piece of server software when using an abstracted client SDK.

saikishor commented 6 years ago

Agreed!!