<jupyter_start><jupyter_text>Import the libraries so that they can be used within the notebook* **requests** is used to make HTTP calls* **json** is used to encode and decode strings into JSON* **string** is used to perform text manipulation and checking* **getpass** is used to do non-echoing password input<jupyter_code>import requests
import json
import string
import getpass<jupyter_output><empty_output><jupyter_text>The **base_url** holds the URL to the SEEK instance that will be used in the notebook**headers** holds the HTTP headers that will be sent with every HTTP call* **Content-type: application/vnd.api+json** - indicates that any data sent will be in JSON API format* **Accept: application/vnd.api+json** - indicates that the notebook expects any data returned to be in JSON API format* **Accept-Charset: ISO-8859-1** - indicates that the notebook expects any text returned to be in ISO-8859-1 character set<jupyter_code>base_url = 'http://www.fairdomhub.org/'

headers = {"Content-type": "application/vnd.api+json",
           "Accept": "application/vnd.api+json",
           "Accept-Charset": "ISO-8859-1"}<jupyter_output><empty_output><jupyter_text>Create a **requests** HTTP **Session**. A **Session** has re-usable settings such as **headers**The **authorization** is username and password. The user is prompted for this information.<jupyter_code>session = requests.Session()
session.headers.update(headers)
session.auth = (input('Username:'), getpass.getpass('Password'))<jupyter_output><empty_output><jupyter_text>Perform a test **GET** to ensure the username and password worked<jupyter_code>r = session.get(base_url + 'models/311')

r.raise_for_status()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11533957845433256, 'fraction_numerical': 0.01053864168618267, 'mean_word_length': 5.919028340080971, 'pattern_counts': {'":': 3, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '10690', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 507, 'n_tokens_neox': 486, 'n_words': 175, 'path': 'authorize.ipynb', 'repo_name': 'seek4science/seekAPIexamples', 'size': '1708'}