kijiji-manager


Namekijiji-manager JSON
Version 0.2.4 PyPI version JSON
download
home_pagehttps://github.com/jackm/kijiji-manager
SummaryApp for viewing, posting, reposting, and deleting your Kijiji ads
upload_time2023-11-11 15:44:29
maintainer
docs_urlNone
authorjackm
requires_python>=3.7
licenseMIT
keywords kijiji ad manager reposter automation bot flask
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Kijiji Manager

Kijiji Manager app for viewing, posting, reposting, and deleting your Kijiji ads.

Built using the [Flask](https://flask.palletsprojects.com/) framework with Python 3.7+.
Completely API driven, with no web scraping. Runs a local webserver which provides the web user interface.

Kijiji Manager is able to handle all types of ads under every Kijiji category (although not every ad type has been extensively tested).

If you find any bugs with posting ads, please create a new issue to report it.

## Requirements

Kijiji Manager requires Python 3.7+.
Most manual testing is done on Python 3.7.

#### Minimum dependencies

* `Flask`
* `Flask-WTF`
* `Flask-Login`
* `Flask-Executor`
* `WTForms`
* `httpx`
* `xmltodict`
* `is-safe-url`
* `phonenumbers`
* `pgeocode`

## Installation

1. Install from source
    1. Clone this repository
       ```
       git clone https://github.com/jackm/kijiji-manager.git
       cd kijiji-manager
       ```
    1. Create a new virtualenv (optional but highly recommended)
       ```
       python3 -m venv venv
       source venv/bin/activate
       ```
       * When using a virtualenv, you must source the `venv/bin/activate` script each time you start a new shell, otherwise the installed Python packages will not be available
       * If using a Debian based Linux distro, and the _venv_ Python library is not found or if there is an error about missing _ensurepip_, you will have to apt install `python3-venv` first
       * If using Windows, you may have to use the `py` command in place of `python` or `python3`
       * If using Windows, the activate script will be at `venv/Scripts/Activate` instead
       * See the Python [virtual environments tutorial](https://docs.python.org/3.7/tutorial/venv.html) for more information
    1. Install the kijiji-manager package from the current directory\
       `pip install .`
1. Copy the sample config file at [`kijiji_manager/kijiji-manager-sample.cfg`](kijiji_manager/kijiji-manager-sample.cfg) and rename it to `kijiji-manager.cfg`, putting it in the instance folder
    * Create a folder named `instance` at the root of this repository if it does not exist
1. Edit the secret key variable on the first line in `instance/kijiji-manager.cfg` to a random value
    * To generate a random value you can run the following and copy the output:\
      `python -c "import secrets; print(secrets.token_urlsafe(16))"`
1. Run the app from a shell/terminal: `python -m kijiji_manager` or `kijiji-manager -c instance/kijiji-manager.cfg`
    * Append `--help` to see all possible command line arguments
1. Open a browser and go to http://localhost:5000/ or http://127.0.0.1:5000/
    * Cookies must be enabled in order to log in
1. Login using an existing Kijiji account
    * You must register for a new account on [kijiji.ca](https://www.kijiji.ca/) if you do not yet have one

For all subsequent runs, start the app again using `python -m kijiji_manager` or `kijiji-manager -c instance/kijiji-manager.cfg` and then go to the web interface in your browser.
You can also leave the app running in the terminal if you wish.
No background HTTP calls are made unless you refresh or load new pages.

## Limitiations

Kijiji employs duplicate ad detection algorithms to try and spot same ads that were recently deleted and then posted again.
Some mitigations have been done here to try and avoid detection, but it is still highly recommended to wait at least 24 hours before attempting to repost an ad.
If you find that after reposting an ad that it has immediately disappeared, it is likely that it has been flagged as a duplicate and Kijiji has automatically deleted it.

Note that the original ad contents is still saved in the ad XML payload file located in your user instance folder.
You can attempt to post this ad again using the "Post Manual" page and selecting the corresponding XML payload file.

## Command line arguments

```bash
usage: kijiji-manager [-h] [-c CONFIG] [-b BIND] [-p PORT] [-d]

optional arguments:
  -h, --help            show this help message and exit
  -c CONFIG, --config CONFIG
                        path to config file
  -b BIND, --bind BIND  interface to bind to (default: localhost)
  -p PORT, --port PORT  port to bind to (default: 5000)
  -d, --debug           enable debugging
```

## Default form values

Default values for certain form fields can be chosen by adding any of the following variables to their `instance/kijiji-manager.cfg` config file:

* `DEFAULT_AD_TITLE`
* `DEFAULT_AD_DESCRIPTION`
* `DEFAULT_AD_PRICE`
* `DEFAULT_POSTAL_CODE`
* `DEFAULT_FULL_ADDRESS`
* `DEFAULT_PHONE`
* `DEFAULT_LOCATION2_CONTAINS`
  * Select second location tier by checking if location label contains given string value; case-insensitive
* `DEFAULT_LOCATION3_CONTAINS`
  * Select third location tier (if required) by checking if location label contains given string value; case-insensitive

Note that these config values are only read once during startup - you will need to restart the app for any changes to take effect.

e.g.

```
DEFAULT_AD_TITLE = 'This is a test ad title'
DEFAULT_AD_DESCRIPTION = 'This is a test ad description'
DEFAULT_AD_PRICE = 149.99
DEFAULT_POSTAL_CODE = 'A1A 1A1'
DEFAULT_FULL_ADDRESS = '123 Main St.'
DEFAULT_PHONE = '555-5555'
DEFAULT_LOCATION2_CONTAINS = 'Toronto'
DEFAULT_LOCATION3_CONTAINS = 'Markham'
```

## Docker container

A [Dockerfile](Dockerfile) is provided as well as a [docker-compose.yml](docker-compose.yml) file to allow running this app within a [Docker](https://docs.docker.com/) container.
At minimum this method will require [Docker to be installed](https://docs.docker.com/get-docker/).

Using this method does not require installing any Python packages locally - the whole app will be installed and run within an isolated container.

You should still create a `instance/kijiji-manager.cfg` file containing a randomly generated secret key within the instance folder (steps 2 and 3 of _Installation_).
By default, the web interface will still be reachable at http://localhost:5000/ or http://127.0.0.1:5000/.

If you want to provide a custom config file path other than `instance/kijiji-manager.cfg`, this can be done by setting the `CONFIG_FILE` environment variable when running the container.

### Docker Compose

Docker Compose is an additional tool that can be used to easily deploy app containers.
In this case, Docker Compose is used to automatically build and run the app container. 

Run `docker-compose up` from the root of this repository.

If changes are made to the _kijiji_manager_ package, you will have to run `docker-compose up --build` instead to force rebuild the container image.

### Without Docker Compose

If you do not want to use Docker Compose, you can build the container image and then run the container using the following commands from the root of this repository:

```
docker build -t kijiji-manager .
docker run --rm --name kijiji-manager -p 5000:80 -v "$(pwd)"/instance:/app/instance kijiji-manager
```

Append the `--detach` option to the `docker run` command to run the container in the background (detached mode).

## Screenshots

![Login page](https://user-images.githubusercontent.com/4127823/86979816-3ccf8980-c150-11ea-9b16-1d4a9612ad6b.png)

![Home page](https://user-images.githubusercontent.com/4127823/94874784-dee5d180-0420-11eb-802c-2cb8c55f7bb4.png)

![Show ad page](https://user-images.githubusercontent.com/4127823/86979503-8075c380-c14f-11ea-997b-1ecf84066c2e.png)

![Post ad step 1](https://user-images.githubusercontent.com/4127823/86979508-823f8700-c14f-11ea-963a-4366119303d2.png)

![Post ad step 2](https://user-images.githubusercontent.com/4127823/86979510-8370b400-c14f-11ea-8293-13846c1c8c40.png)

## Credits

Many of the core architecture concepts have been borrowed from the [Kijiji-Reposter](https://github.com/rybodiddly/Kijiji-Reposter/) project.
Many thanks to [rybodiddly](https://github.com/rybodiddly/) for the work they have done, especially on the Kijiji API.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/jackm/kijiji-manager",
    "name": "kijiji-manager",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "kijiji,ad,manager,reposter,automation,bot,flask",
    "author": "jackm",
    "author_email": "jackm@ehelion.com",
    "download_url": "https://files.pythonhosted.org/packages/fd/f7/3ce054bd53765162771cf47495c2317ac5677f9e90212eab3c3d0e90dc94/kijiji-manager-0.2.4.tar.gz",
    "platform": null,
    "description": "# Kijiji Manager\n\nKijiji Manager app for viewing, posting, reposting, and deleting your Kijiji ads.\n\nBuilt using the [Flask](https://flask.palletsprojects.com/) framework with Python 3.7+.\nCompletely API driven, with no web scraping. Runs a local webserver which provides the web user interface.\n\nKijiji Manager is able to handle all types of ads under every Kijiji category (although not every ad type has been extensively tested).\n\nIf you find any bugs with posting ads, please create a new issue to report it.\n\n## Requirements\n\nKijiji Manager requires Python 3.7+.\nMost manual testing is done on Python 3.7.\n\n#### Minimum dependencies\n\n* `Flask`\n* `Flask-WTF`\n* `Flask-Login`\n* `Flask-Executor`\n* `WTForms`\n* `httpx`\n* `xmltodict`\n* `is-safe-url`\n* `phonenumbers`\n* `pgeocode`\n\n## Installation\n\n1. Install from source\n    1. Clone this repository\n       ```\n       git clone https://github.com/jackm/kijiji-manager.git\n       cd kijiji-manager\n       ```\n    1. Create a new virtualenv (optional but highly recommended)\n       ```\n       python3 -m venv venv\n       source venv/bin/activate\n       ```\n       * When using a virtualenv, you must source the `venv/bin/activate` script each time you start a new shell, otherwise the installed Python packages will not be available\n       * If using a Debian based Linux distro, and the _venv_ Python library is not found or if there is an error about missing _ensurepip_, you will have to apt install `python3-venv` first\n       * If using Windows, you may have to use the `py` command in place of `python` or `python3`\n       * If using Windows, the activate script will be at `venv/Scripts/Activate` instead\n       * See the Python [virtual environments tutorial](https://docs.python.org/3.7/tutorial/venv.html) for more information\n    1. Install the kijiji-manager package from the current directory\\\n       `pip install .`\n1. Copy the sample config file at [`kijiji_manager/kijiji-manager-sample.cfg`](kijiji_manager/kijiji-manager-sample.cfg) and rename it to `kijiji-manager.cfg`, putting it in the instance folder\n    * Create a folder named `instance` at the root of this repository if it does not exist\n1. Edit the secret key variable on the first line in `instance/kijiji-manager.cfg` to a random value\n    * To generate a random value you can run the following and copy the output:\\\n      `python -c \"import secrets; print(secrets.token_urlsafe(16))\"`\n1. Run the app from a shell/terminal: `python -m kijiji_manager` or `kijiji-manager -c instance/kijiji-manager.cfg`\n    * Append `--help` to see all possible command line arguments\n1. Open a browser and go to http://localhost:5000/ or http://127.0.0.1:5000/\n    * Cookies must be enabled in order to log in\n1. Login using an existing Kijiji account\n    * You must register for a new account on [kijiji.ca](https://www.kijiji.ca/) if you do not yet have one\n\nFor all subsequent runs, start the app again using `python -m kijiji_manager` or `kijiji-manager -c instance/kijiji-manager.cfg` and then go to the web interface in your browser.\nYou can also leave the app running in the terminal if you wish.\nNo background HTTP calls are made unless you refresh or load new pages.\n\n## Limitiations\n\nKijiji employs duplicate ad detection algorithms to try and spot same ads that were recently deleted and then posted again.\nSome mitigations have been done here to try and avoid detection, but it is still highly recommended to wait at least 24 hours before attempting to repost an ad.\nIf you find that after reposting an ad that it has immediately disappeared, it is likely that it has been flagged as a duplicate and Kijiji has automatically deleted it.\n\nNote that the original ad contents is still saved in the ad XML payload file located in your user instance folder.\nYou can attempt to post this ad again using the \"Post Manual\" page and selecting the corresponding XML payload file.\n\n## Command line arguments\n\n```bash\nusage: kijiji-manager [-h] [-c CONFIG] [-b BIND] [-p PORT] [-d]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -c CONFIG, --config CONFIG\n                        path to config file\n  -b BIND, --bind BIND  interface to bind to (default: localhost)\n  -p PORT, --port PORT  port to bind to (default: 5000)\n  -d, --debug           enable debugging\n```\n\n## Default form values\n\nDefault values for certain form fields can be chosen by adding any of the following variables to their `instance/kijiji-manager.cfg` config file:\n\n* `DEFAULT_AD_TITLE`\n* `DEFAULT_AD_DESCRIPTION`\n* `DEFAULT_AD_PRICE`\n* `DEFAULT_POSTAL_CODE`\n* `DEFAULT_FULL_ADDRESS`\n* `DEFAULT_PHONE`\n* `DEFAULT_LOCATION2_CONTAINS`\n  * Select second location tier by checking if location label contains given string value; case-insensitive\n* `DEFAULT_LOCATION3_CONTAINS`\n  * Select third location tier (if required) by checking if location label contains given string value; case-insensitive\n\nNote that these config values are only read once during startup - you will need to restart the app for any changes to take effect.\n\ne.g.\n\n```\nDEFAULT_AD_TITLE = 'This is a test ad title'\nDEFAULT_AD_DESCRIPTION = 'This is a test ad description'\nDEFAULT_AD_PRICE = 149.99\nDEFAULT_POSTAL_CODE = 'A1A 1A1'\nDEFAULT_FULL_ADDRESS = '123 Main St.'\nDEFAULT_PHONE = '555-5555'\nDEFAULT_LOCATION2_CONTAINS = 'Toronto'\nDEFAULT_LOCATION3_CONTAINS = 'Markham'\n```\n\n## Docker container\n\nA [Dockerfile](Dockerfile) is provided as well as a [docker-compose.yml](docker-compose.yml) file to allow running this app within a [Docker](https://docs.docker.com/) container.\nAt minimum this method will require [Docker to be installed](https://docs.docker.com/get-docker/).\n\nUsing this method does not require installing any Python packages locally - the whole app will be installed and run within an isolated container.\n\nYou should still create a `instance/kijiji-manager.cfg` file containing a randomly generated secret key within the instance folder (steps 2 and 3 of _Installation_).\nBy default, the web interface will still be reachable at http://localhost:5000/ or http://127.0.0.1:5000/.\n\nIf you want to provide a custom config file path other than `instance/kijiji-manager.cfg`, this can be done by setting the `CONFIG_FILE` environment variable when running the container.\n\n### Docker Compose\n\nDocker Compose is an additional tool that can be used to easily deploy app containers.\nIn this case, Docker Compose is used to automatically build and run the app container. \n\nRun `docker-compose up` from the root of this repository.\n\nIf changes are made to the _kijiji_manager_ package, you will have to run `docker-compose up --build` instead to force rebuild the container image.\n\n### Without Docker Compose\n\nIf you do not want to use Docker Compose, you can build the container image and then run the container using the following commands from the root of this repository:\n\n```\ndocker build -t kijiji-manager .\ndocker run --rm --name kijiji-manager -p 5000:80 -v \"$(pwd)\"/instance:/app/instance kijiji-manager\n```\n\nAppend the `--detach` option to the `docker run` command to run the container in the background (detached mode).\n\n## Screenshots\n\n![Login page](https://user-images.githubusercontent.com/4127823/86979816-3ccf8980-c150-11ea-9b16-1d4a9612ad6b.png)\n\n![Home page](https://user-images.githubusercontent.com/4127823/94874784-dee5d180-0420-11eb-802c-2cb8c55f7bb4.png)\n\n![Show ad page](https://user-images.githubusercontent.com/4127823/86979503-8075c380-c14f-11ea-997b-1ecf84066c2e.png)\n\n![Post ad step 1](https://user-images.githubusercontent.com/4127823/86979508-823f8700-c14f-11ea-963a-4366119303d2.png)\n\n![Post ad step 2](https://user-images.githubusercontent.com/4127823/86979510-8370b400-c14f-11ea-8293-13846c1c8c40.png)\n\n## Credits\n\nMany of the core architecture concepts have been borrowed from the [Kijiji-Reposter](https://github.com/rybodiddly/Kijiji-Reposter/) project.\nMany thanks to [rybodiddly](https://github.com/rybodiddly/) for the work they have done, especially on the Kijiji API.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "App for viewing, posting, reposting, and deleting your Kijiji ads",
    "version": "0.2.4",
    "project_urls": {
        "Homepage": "https://github.com/jackm/kijiji-manager"
    },
    "split_keywords": [
        "kijiji",
        "ad",
        "manager",
        "reposter",
        "automation",
        "bot",
        "flask"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "16439a3b8d26a551d533d873575c2720f2fe44ff32344df1240fbabd1ff5ae3a",
                "md5": "bf1839930716537627911cffff264423",
                "sha256": "2fa24111f2f62a741566347407dca652a7320f22c2c82c49389ac949a12fd405"
            },
            "downloads": -1,
            "filename": "kijiji_manager-0.2.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bf1839930716537627911cffff264423",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 42170,
            "upload_time": "2023-11-11T15:44:27",
            "upload_time_iso_8601": "2023-11-11T15:44:27.752083Z",
            "url": "https://files.pythonhosted.org/packages/16/43/9a3b8d26a551d533d873575c2720f2fe44ff32344df1240fbabd1ff5ae3a/kijiji_manager-0.2.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fdf73ce054bd53765162771cf47495c2317ac5677f9e90212eab3c3d0e90dc94",
                "md5": "9517e6b643a9d1dfa89ad870b669a658",
                "sha256": "f6659030a0ecde9f9a610aefb152f5016ccc0fbd27422cd1e3bcb19df75dfa6c"
            },
            "downloads": -1,
            "filename": "kijiji-manager-0.2.4.tar.gz",
            "has_sig": false,
            "md5_digest": "9517e6b643a9d1dfa89ad870b669a658",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 34709,
            "upload_time": "2023-11-11T15:44:29",
            "upload_time_iso_8601": "2023-11-11T15:44:29.267472Z",
            "url": "https://files.pythonhosted.org/packages/fd/f7/3ce054bd53765162771cf47495c2317ac5677f9e90212eab3c3d0e90dc94/kijiji-manager-0.2.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-11 15:44:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jackm",
    "github_project": "kijiji-manager",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "kijiji-manager"
}
        
Elapsed time: 3.00576s