Created
June 3, 2015 18:20
-
-
Save elderamevans/3911cc0e858729b9ad94 to your computer and use it in GitHub Desktop.
Familysearch-Python SDK desktop login diagnoser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
from urllib.error import HTTPError | |
raw_input = input | |
except ImportError: | |
from urllib2 import HTTPError | |
from getpass import getpass | |
import json | |
from familysearch import FamilySearch | |
base = raw_input("Base: ") | |
key = raw_input("Key: ") | |
username = raw_input("Username: ") | |
password = getpass() | |
fs = FamilySearch("FSPySDK/1.0", key, base=base) | |
try: | |
fs.login(username, password) | |
except HTTPError as e: | |
response = e.read() | |
response = response.decode("UTF-8") | |
response = json.loads(response) | |
print("Error:",response["error_description"]) | |
else: | |
print("All is well; signed in successfully.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment