You are on page 1of 10

CA Python

Exercise
03.10 | 28.10
Mentors

Emil Lyubomirov - emil.lyubomirov@strypes.eu

Kiril Kostov - kiril.kostov@strypes.eu

Zlatina Cholakova - zlatina.cholakova@strypes.eu


The exercise

Book scraper:
1. automatically gather info from the provided website
2. filter and sort the data
3. GUI using tkinter
4. tests and documentation
Training

4 weeks - the scraper is divided into 3 tasks - scraper, data process, representation of data

● Documentation and tests should be parallel to the process

● The new task will be given out each week

● Code review for each part


Interaction

1 weekly meeting - 1 hour per team.

● Teams present task, answer questions from mentors.

● Mentors answer/discuss technical questions that are prepared and sent in advance

● Trainees upload code in a git repo

● Pull requests & code review


Project requirements
1st week.
● Documentation:
planning of the idea and main structure of the documentation
● Books scraping (http://books.toscrape.com):
Get the proper n books depending on the input and collect them in a chosen data
structure
2nd week. Data processing:
● The data must be filtered depending on the input
● The data must be sorted depending on the input
● The formatted data must be stored in a json
3rd week. Output:
● The data must be read from the file and represented in tkinter
● The format of the representation is not predefined
4th week. Final touches
Overall requirements:
● Tests, documentation, OOP design
● Modules : requests, beautifulsoup, tkinter e.t.c.
● Python 2.7
Input example
Proper inputs shall include at least 1 of the following:

● b - number of books
● g - list of genres to search through
● s - list of sortings (for the output, ascending or descending)
● f - list of priority filters for which books to exclude from the scrape
● d - list of keywords to be searched from the description
● t - title of a book to search for
● F - list of book titles to search for (from given json)
● Example:
python main.py -b 50 -g Science -s rating ascending
python main.py -b 24 -g Classics -f rating <3
python main.py -g Fantasy-f price >30
python main.py -b 60 -g Science -f available =14 -d “book”
python main.py -g Science -t “Book Title”
python main.py -X стартира графичен interface в който могат да въведат горните опции.
1. GUI with Tkinter
● Examples:
Project structure
Example project structure :

books_scraper/
|--- main.py
|--- module/
modules/libraries of the project
|--- __init__.py
|--- books.py
|--- README.md
|--- requirements.txt
|--- .gitignore
|--- test/
|--- unit_tests/

You might also like