Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Backend
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
swp-unisport
team-warumkeinrust
Backend
Commits
b592868b
Commit
b592868b
authored
3 years ago
by
borzechof99
Browse files
Options
Downloads
Patches
Plain Diff
Move Course Scraper into quiz
parent
909a747e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
unisportomat/quiz/course_scraper/course_scraper.py
+3
-2
3 additions, 2 deletions
unisportomat/quiz/course_scraper/course_scraper.py
unisportomat/quiz/course_scraper/test_course_scraper.py
+2
-1
2 additions, 1 deletion
unisportomat/quiz/course_scraper/test_course_scraper.py
with
5 additions
and
3 deletions
unisportomat/course_scraper/course_scraper.py
→
unisportomat/
quiz/
course_scraper/course_scraper.py
+
3
−
2
View file @
b592868b
...
...
@@ -5,6 +5,7 @@ for http://www.buchsys.de for SWP UniSport-O-Mat.
import
requests
from
bs4
import
BeautifulSoup
from
collections
import
OrderedDict
def
fetch_website
(
url
):
...
...
@@ -27,14 +28,14 @@ def fetch_website(url):
raise
def
scraping
(
site
=
None
)
->
d
ict
:
def
scraping
(
site
=
None
)
->
OrderedD
ict
:
"""
Returns a dictionary of the form {name: link},
containing the scraped content of
https://www.buchsys.de/fu-berlin/angebote/aktueller_zeitraum/index.html,
unless another URL is given as an argument.
"""
courses
=
{}
courses
=
OrderedDict
()
if
site
is
None
:
site
=
"
https://www.buchsys.de/fu-berlin/angebote/aktueller_zeitraum/
"
...
...
This diff is collapsed.
Click to expand it.
unisportomat/course_scraper/test_course_scraper.py
→
unisportomat/
quiz/
course_scraper/test_course_scraper.py
+
2
−
1
View file @
b592868b
...
...
@@ -3,6 +3,7 @@ Testing module, yo. Just for the course_scraper.py.
"""
from
django.test
import
TestCase
from
course_scraper
import
scraping
# , fetch_website
from
collections
import
OrderedDict
class
ScraperTestCase
(
TestCase
):
...
...
@@ -15,7 +16,7 @@ class ScraperTestCase(TestCase):
"""
Testing return type of scraping().
"""
self
.
assertIsInstance
(
scraping
(),
d
ict
)
self
.
assertIsInstance
(
scraping
(),
OrderedD
ict
)
def
test_dict_not_empty
(
self
):
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment