This is sample django project built by Roman Fedorov (rfedorov@linkentools.com). It has been requested by HR.
Hey Roman,
It's ***, HR at *** team. I'm sending our code challenge. There is no max or min time for it, but the usual range is about 5-7 hours. The deadline for the code challenge will be ***, but feel free to let me know if you need some more time.
In terms of our task, we would like you to:
-
Create a new web application using Django
-
Scrape the Ticketmaster Discovery API for events https://developer.ticketmaster.com/products-and-docs/apis/discovery-api/v2/ Don’t scrape everything. 50 pages should be enough because of API keys are limited by 5k requests per day.
-
Store and/or structure the events that you scrape into your Django application. Event should have at least: event name, promoter name if it exists, description, multiple prices, url, start date, finish date)
-
Inside your Django app, create a searchable api endpoint (returns json) allow the api request to search for event name, event start date, promoter name, ticket cost (min and max for a standard price).
-
Inside your application, create 1 API endpoint that accepts json that allows a user to update the locally stored event record, create some arbitrary validations.
-
Send us the code and the URL to your hosted application.
-
Write Tests you find necessary
Ticketmaster API key: *** Please let us know in case you experience any issues with this. Looking forward to hearing from you!
This project based on wms django template
:
- Always up-to-date with the help of
@dependabot
- Supports latest
python3.7+
poetry
for managing dependenciesmypy
anddjango-stubs
for static typingpytest
andhypothesis
for unit testsflake8
andwemake-python-styleguide
for lintingdocker
for development, testing, and productionGitlab CI
with fullbuild
,test
, anddeploy
pipeline configured by default
Primary Python libraries:
django
2.2.12 (main framework)djangorestframework
(json REST API)djangorestframework-filters
(powerful filters)pytest-vcr
(save API output in cassettes for tests)tqdm
(display download progress)jsonschema
(validate input json)
server/apps/main
- django root
server/apps/main/event
- primary event logic
server/apps/main/management/commands/get_events.py
- download event logic
server_tests
- all tests here
server_tests/test_apps/test_main/test_event
- event tests
server_tests/test_apps/test_main/test_event/cassettes/test_get_events.yaml
- event cassettes, prevent real API calls in tests
https://ticket.rfedorov.ru/api/event/
primary url with deployed version
list all Events in default django admin
View/Edit/Delete Event with id G5vVZ4U9eCe11
/api/event/?limit=20&offset=0&cost_min__lte=50&name__contains=Seattle
simple filter with sql equivalent cost_min <= 50 and name like %Seattle%
filter Events according next logic:
cost_min
<=50
promoter_name
contains textREGULAR
name
regex matchYork
start_date
get hour23
Supported filters:
- exact
- iexact
- contains
- icontains
- in
- gt
- gte
- lt
- lte
- startswith
- istartswith
- endswith
- iendswith
- range
- date
- year
- iso_year
- month
- day
- week
- week_day
- quarter
- time
- hour
- minute
- second
- isnull
- regex
- iregex