Skip to content

Commit

Permalink
finalization
Browse files Browse the repository at this point in the history
- .idea
! yield super-category due to some goods have no category, only a super-category
+ readme
+ examples
! requirements
+ notifications via knockknock
! moved all os variables to constants
! expanded constants to os variables
+ Dockerfile
+ docker image deploy script
+ crontab
! optimization
! refactoring
  • Loading branch information
ALERTua committed Sep 3, 2022
1 parent 1457267 commit d808ccd
Show file tree
Hide file tree
Showing 31 changed files with 845 additions and 757 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
*logs/
venv/
.idea/
__pycache__
.env
.idea
8 changes: 0 additions & 8 deletions .idea/.gitignore

This file was deleted.

14 changes: 0 additions & 14 deletions .idea/deployment.xml

This file was deleted.

10 changes: 0 additions & 10 deletions .idea/inspectionProfiles/Project_Default.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/inspectionProfiles/profiles_settings.xml

This file was deleted.

4 changes: 0 additions & 4 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

10 changes: 0 additions & 10 deletions .idea/rozetka.iml

This file was deleted.

13 changes: 13 additions & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
=======
Credits
=======

Developer
---------

* Alexey Rubasheff <[email protected]>

Contributors
------------

None yet. Why not be the first?
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM python
MAINTAINER ALERT <[email protected]>

RUN apt-get update && apt-get -y install cron vim

WORKDIR /app

COPY rozetka/requirements/requirements.txt /app/
RUN pip install --user --progress-bar=off -U pip setuptools wheel && pip install --user --progress-bar=off -r /app/requirements.txt

COPY crontab /etc/cron.d/crontab
RUN chmod 0644 /etc/cron.d/crontab

COPY entrypoint.sh /app/
RUN chmod +x /app/entrypoint.sh

COPY rozetka /app/rozetka/

RUN /usr/bin/crontab /etc/cron.d/crontab

ENV PYTHONIOENCODING=utf-8
ENV LC_ALL=en_US.UTF-8
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US.UTF-8

# run crond as main process of container
# CMD ["cron", "-f"]
CMD ["/app/entrypoint.sh"]
8 changes: 8 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
=======
History
=======

0.1.0 (2022-09-03)
------------------

* First release
11 changes: 4 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
Rozetka.ua Python API
---------------------

Usage
^^^^^
Examples
^^^^^^^^

.. code:: py
rozetka/examples/example_item.py

from rozetka.entities.grid import Grid
grid = Grid.get('(your filter url)')
print(f"Parsed {len(grid.parsed_cells)} cells")
print(f"Cheapest one: {grid.cheapest_cell}")
rozetka/examples/example_category.py
2 changes: 2 additions & 0 deletions crontab
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
0 1,12 * * * /entrypoint.sh > /proc/1/fd/1 2>/proc/1/fd/2
# * * * * * /entrypoint.sh > /proc/1/fd/1 2>/proc/1/fd/2
16 changes: 16 additions & 0 deletions deploy.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@echo off
set REGISTRY_IP=192.168.1.3
set REGISTRY_PORT=5001
set IMAGE_NAME=rozetka
set IMAGE_TAG=latest
set BUILD_TAG=%REGISTRY_IP%:%REGISTRY_PORT%/%IMAGE_NAME%:%IMAGE_TAG%
set BUILD_PATH=.

set "_DOCKER=docker"
@REM set "_DOCKER=C:\Program Files\Docker\Docker\resources\bin\docker.exe"

pushd %~dp0
@REM net start com.docker.service || exit /b
"%_DOCKER%" build -t %BUILD_TAG% %BUILD_PATH% || exit /b
"%_DOCKER%" push %REGISTRY_IP%:%REGISTRY_PORT%/%IMAGE_NAME% || exit /b
@REM net stop com.docker.service || exit /b
6 changes: 6 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
echo "start rozetka @ $(pwd)"
python -c "from rozetka.runners.parse_api import main; main()"
echo "done rozetka"
# crontab -f
# echo "rozetka cron done"
Loading

0 comments on commit d808ccd

Please sign in to comment.