Move hk credential and client management to a package: hkclient

When writing hk plugins or a lot of small client software, figuring
out how to get credentials is a burden.

To help with this, move all the credential and HTTP endpoint discovery
and configuration logic into a package that can be imported elsewhere,
with the explicit goal of with having closely-coupled parity with
'hk'.