scolby33 / OCSPdash

A dashboard for the status of the top certificate authorities' OCSP responders.
MIT License
1 stars 0 forks source link

Set custom User-Agent #12

Closed scolby33 closed 6 years ago

scolby33 commented 7 years ago

In case something goes terribly wrong and we start taking down other people's servers, it'd be nice if they could know who did it.

Easy to set on the requests requests, but might require monkeypatching the Censys API thing to change it there.

cthoyt commented 7 years ago

I don't think monkey patch - just override the functions in our inherited version of the class... maybe re-write bits?

If you want to add hooks in then it might even be a good idea to refactor the class and make a PR to them

scolby33 commented 7 years ago

The Censys api creates a requests.Session() here. It should be easy to update the headers with the new User-Agent just like they do on line 62.

Perhaps we should also use a Session in server_query and the cli to manage the headers.

P.S. I tried just putting the link in, but I guess code snippets only work on your own repo.

scolby33 commented 7 years ago

I'll change this for our usages of requests explicitly but I'll wait on modifying the Censys api stuff until I hear back from the pull request or too much time passes.

scolby33 commented 7 years ago

Well that was fast! It got merged. Now do we just specify the GitHub commit in setup.py and requirements until they make a release? I think so.

scolby33 commented 7 years ago

Never mind, that doesn't work. We'll have to wait for a release from Censys' end.

See a5903154ccd6be5404e5929056b893dcb272a4a3

cthoyt commented 7 years ago

You can specify the git location in requirements not setup.py On Wed 23. Aug 2017 at 22:50, Scott Colby notifications@github.com wrote:

Nevermind, that doesn't work. We'll have to wait for a release from Censys' end.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/scolby33/OCSPdash/issues/12#issuecomment-324458352, or mute the thread https://github.com/notifications/unsubscribe-auth/AE1bqIOOFy9xiW5M3OsjIqka90gzGqSoks5sbJB_gaJpZM4O-PxX .

scolby33 commented 7 years ago

You can set it in setup.py with some strange contortions.

However, the real problem is if I specify version 0.0.7, then it gets it directly from PyPI. If I make up a version like 0.0.7-dev, then it'll get it from GitHub but then pkg_resources can't verify it's there when running the CLI--it sees a version mismatch.

shrug I'm willing to wait.

cthoyt commented 7 years ago

Hmm okay i saw what you did. It's wayyy complicated so hopefully they'll make a new release soon