CognitiveScience commited on
Commit
fe493ae
1 Parent(s): ff4a76f

Create ecogsphere.py

Browse files
Files changed (1) hide show
  1. ecogsphere.py +34 -0
ecogsphere.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ import os
3
+ import math
4
+ import json
5
+ #import pandas as pd
6
+
7
+ RB_TOKEN=str(int(math.sqrt(1)+math.factorial(int(math.log2(int(math.log10(10)))))))
8
+
9
+ RA_TOKEN = os.environ.get('RA_KEY')
10
+ if RA_TOKEN is None:
11
+ RA_TOKEN=""
12
+ RA_TOKEN = "bd9aa1d28bmsh04ce300944d4185p14d490jsn690bae90367"+ RB_TOKEN+RA_TOKEN
13
+
14
+ url = "https://youtube-search-results.p.rapidapi.com/youtube-search/"
15
+
16
+ headers = {
17
+ "X-RapidAPI-Key": RA_TOKEN,
18
+ "X-RapidAPI-Host": "youtube-search-results.p.rapidapi.com"
19
+ }
20
+
21
+ def ecf(inp):
22
+ inp = {"q":inp}
23
+
24
+
25
+ if inp is None:
26
+ response2 = "No Input!"
27
+ else:
28
+ try:
29
+ response1 = requests.get(url, headers=headers, params=inp)
30
+ response2=response1.json()
31
+ except NameError:
32
+ response2="Wrong Input!"
33
+
34
+ return response2