Re-add sha1hash for password

Re-add the sha1hash calculation on the password, and use this as the
password in basic HTTP auth, as per the api documentation.

Fixed import of sha1 as well, so it no longer gives a deprecated warning.