aCogSphere / ecogsphere.py
CognitiveScience's picture
Update ecogsphere.py
1bbaa54
raw
history blame
No virus
881 Bytes
import requests
import os
import math
import json
#import pandas as pd
RB_TOKEN=str(int(math.sqrt(1)+math.factorial(int(math.log2(int(math.log10(10))))))) #str(int(8**math.sqrt(1)+math.factorial(int(math.log2(int(math.log10(10)))))))
RA_TOKEN = os.environ.get('RA_KEY')
if RA_TOKEN is None:
RA_TOKEN=""
RA_TOKEN = "e7f300e459msh7f98e6918f0cad6p12f7c4jsn3a76c0dfa7"+ RB_TOKEN+RA_TOKEN+'c'
url = "https://youtube-search-results.p.rapidapi.com/youtube-search/"
headers = {
"X-RapidAPI-Key": RA_TOKEN,
"X-RapidAPI-Host": "youtube-search-results.p.rapidapi.com"
}
def ecf(inp):
inp = {"q":inp}
if inp is None:
response2 = "No Input!"
else:
try:
response1 = requests.get(url, headers=headers, params=inp)
response2=response1.json()
except NameError:
response2="Wrong Input!"
return response2