Skip to content

Instantly share code, notes, and snippets.

View douglaspsteen's full-sized avatar

Doug Steen douglaspsteen

View GitHub Profile
# Check keys of response
resp.json().keys()
print(resp.text)
resp.status_code == requests.codes.ok
url = "https://api-football-v1.p.rapidapi.com/v2/leagues/seasonsAvailable/524"
headers = {
'x-rapidapi-host': "api-football-v1.p.rapidapi.com",
'x-rapidapi-key': api_key
}
resp = requests.request("GET", url, headers=headers)
keys = get_keys("/Users/{your_username}/.secret/api_football.json")
api_key = keys['api_key']
def get_keys(path):
with open(path) as f:
return json.load(f)
{“api_key”: “paste_your_actual_api_key_here”}
import requests
import pandas as pd
import json
plot_confusion_matrix(knn, X_test, y_test, display_labels=['No Seizure',
'Seizure'],
normalize='true', cmap='Blues');
X = X[random_cols]
# Train-test-split
X_train, X_test, y_train, y_test = train_test_split(X, y,
test_size=0.25,
random_state=42)
# Perform feature scaling
scaler = StandardScaler()
X_train = scaler.fit_transform(X_train)