Commit 91a37307 authored by Richard Fernando Heise Ferreira's avatar Richard Fernando Heise Ferreira
Browse files

Merge branch 'search-script' into 'upload-scripts'

Search script

See merge request !1
1 merge request!1Search script
Showing with 33 additions and 0 deletions
+33 -0
main.py 0 → 100644
#Script made to search for a specific word [search] in API.
#OBS: This script takes a long time to run.
import requests
#The first learning_object begins at ID = 3
id=3
NUM_OF_LEARNING_OBJECTS = 300000
API_URL = 'https://api.portalmec.c3sl.ufpr.br/v1/learning_objects/'
ATTRIBUTE_FOR_SEARCH = 'name'
search = input()
while ( id<NUM_OF_LEARNING_OBJECTS ):
try:
response = requests.get(API_URL+ str(id))
data = response.json()
if ( data[ATTRIBUTE_FOR_SEARCH].find(search) != -1 ):
print(data[ATTRIBUTE_FOR_SEARCH])
id+=1
except:
id+=1
print("Finalizado")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment