Package: kijiji-manager
Kijiji ManagerKijiji Manager app for viewing, posting, reposting, and deleting your Kijiji ads.Built using theFlaskframework 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.RequirementsKijiji Manager requires Python 3.7+.
Most manual testing is done on Python 3.7.Minimum dependenciesFlaskFlask-WTFFlask-LoginFlask-ExecutorWTFormshttpxxmltodictis-safe-urlphonenumberspgeocodeInstallationInstall from sourceClone this repositorygit clone https://github.com/jackm/kijiji-manager.git
cd kijiji-managerCreate a new virtualenv (optional but highly recommended)python3 -m venv venv
source venv/bin/activateWhen using a virtualenv, you must source thevenv/bin/activatescript each time you start a new shell, otherwise the installed Python packages will not be availableIf using a Debian based Linux distro, and thevenvPython library is not found or if there is an error about missingensurepip, you will have to apt installpython3-venvfirstIf using Windows, you may have to use thepycommand in place ofpythonorpython3If using Windows, the activate script will be atvenv/Scripts/ActivateinsteadSee the Pythonvirtual environments tutorialfor more informationInstall the kijiji-manager package from the current directorypip install .Copy the sample config file atkijiji_manager/kijiji-manager-sample.cfgand rename it tokijiji-manager.cfg, putting it in the instance folderCreate a folder namedinstanceat the root of this repository if it does not existEdit the secret key variable on the first line ininstance/kijiji-manager.cfgto a random valueTo generate a random value you can run the following and copy the output:python -c "import secrets; print(secrets.token_urlsafe(16))"Run the app from a shell/terminal:python -m kijiji_managerorkijiji-manager -c instance/kijiji-manager.cfgAppend--helpto see all possible command line argumentsOpen a browser and go tohttp://localhost:5000/orhttp://127.0.0.1:5000/Cookies must be enabled in order to log inLogin using an existing Kijiji accountYou must register for a new account onkijiji.caif you do not yet have oneFor all subsequent runs, start the app again usingpython -m kijiji_managerorkijiji-manager -c instance/kijiji-manager.cfgand 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.LimitiationsKijiji 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 argumentsusage:kijiji-manager[-h][-cCONFIG][-bBIND][-pPORT][-d]optionalarguments:-h,--helpshowthishelpmessageandexit-cCONFIG,--configCONFIGpathtoconfigfile-bBIND,--bindBINDinterfacetobindto(default:localhost)-pPORT,--portPORTporttobindto(default:5000)-d,--debugenabledebuggingDefault form valuesDefault values for certain form fields can be chosen by adding any of the following variables to theirinstance/kijiji-manager.cfgconfig file:DEFAULT_AD_TITLEDEFAULT_AD_DESCRIPTIONDEFAULT_AD_PRICEDEFAULT_POSTAL_CODEDEFAULT_FULL_ADDRESSDEFAULT_PHONEDEFAULT_LOCATION2_CONTAINSSelect second location tier by checking if location label contains given string value; case-insensitiveDEFAULT_LOCATION3_CONTAINSSelect third location tier (if required) by checking if location label contains given string value; case-insensitiveNote 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 containerADockerfileis provided as well as adocker-compose.ymlfile to allow running this app within aDockercontainer.
At minimum this method will requireDocker to be installed.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 ainstance/kijiji-manager.cfgfile containing a randomly generated secret key within the instance folder (steps 2 and 3 ofInstallation).
By default, the web interface will still be reachable athttp://localhost:5000/orhttp://127.0.0.1:5000/.If you want to provide a custom config file path other thaninstance/kijiji-manager.cfg, this can be done by setting theCONFIG_FILEenvironment variable when running the container.Docker ComposeDocker 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.Rundocker-compose upfrom the root of this repository.If changes are made to thekijiji_managerpackage, you will have to rundocker-compose up --buildinstead to force rebuild the container image.Without Docker ComposeIf 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-managerAppend the--detachoption to thedocker runcommand to run the container in the background (detached mode).ScreenshotsCreditsMany of the core architecture concepts have been borrowed from theKijiji-Reposterproject.
Many thanks torybodiddlyfor the work they have done, especially on the Kijiji API.