Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PortalMEC
portalmec-scripts
Commits
91a37307
Commit
91a37307
authored
2 years ago
by
Richard Fernando Heise Ferreira
Browse files
Options
Download
Plain Diff
Merge branch 'search-script' into 'upload-scripts'
Search script See merge request
!1
parents
fab2c955
df1e25b3
upload-scripts
1 merge request
!1
Search script
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
main.py
+33
-0
main.py
with
33 additions
and
0 deletions
+33
-0
main.py
0 → 100644
+
33
-
0
View file @
91a37307
#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"
)
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help