Installation

At the command line:

$ pip install dateparser

Or, if you don’t have pip installed:

$ easy_install dateparser

If you want to install from the latest sources, you can do:

$ git clone https://github.com/scrapinghub/dateparser.git
$ cd dateparser
$ python setup.py install

Deploying dateparser in a Scrapy Cloud project

The initial use cases for dateparser were for Scrapy projects doing web scraping that needed to parse dates from websites. These instructions show how you can deploy it in a Scrapy project running in Scrapy Cloud.

Deploying with shub

The most straightforward way to do that is to use the latest version of the shub command line tool.

First, install shub, if you haven’t already:

pip install shub

Then, you can choose between deploying a stable release or the latest from development.

Deploying a stable dateparser release:

  1. Then, use shub to install python-dateutil (we require at least 2.3 version), jdatetime and PyYAML dependencies from PyPI:

    shub deploy-egg --from-pypi python-dateutil YOUR_PROJECT_ID
    shub deploy-egg --from-pypi jdatetime YOUR_PROJECT_ID
    shub deploy-egg --from-pypi PyYAML YOUR_PROJECT_ID
    
  2. Finally, deploy dateparser from PyPI:

    shub deploy-egg --from-pypi dateparser YOUR_PROJECT_ID
    

Deploying from latest sources

Optionally, you can deploy it from the latest sources:

Inside the dateparser root directory:

  1. Run the command to deploy the dependencies:

    shub deploy-reqs YOUR_PROJECT_ID requirements.txt
    
  2. Then, either deploy from the latest sources on GitHub:

    shub deploy-egg --from-url git@github.com:scrapinghub/dateparser.git YOUR_PROJECT_ID
    

Or, just deploy from the local sources (useful if you have local modifications):

shub deploy-egg

Deploying the egg manually

In case you run into trouble with the above procedure, you can deploy the egg manually. First clone the dateparser‘s repo, then inside its directory run the command:

python setup.py bdist_egg

After that, you can upload the egg using Scrapy Cloud’s Dashboard interface under Settings > Eggs section.

Dependencies

Similarly, you can download source and package PyYAML, jdatetime and dateutil (version >= 2.3) as eggs and deploy them like above.