scrachy


Namescrachy JSON
Version 0.12.0 PyPI version JSON
download
home_pageNone
SummaryEnhanced functionality for Scrapy.
upload_time2024-10-21 22:22:46
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
license# GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. ## 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. ## 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. ## 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: 1. under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or 2. under the GNU GPL, with none of the additional permissions of this License applicable to that copy. ## 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: 1. Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. 2. Accompany the object code with a copy of the GNU GPL and this license document. ## 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: 1. Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. 2. Accompany the Combined Work with a copy of the GNU GPL and this license document. 3. For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. 4. Do one of the following: 1. Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 2. Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. 5. Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4.4.1., the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4.4.2., you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) ## 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: 1. Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. 2. Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. ## 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.
keywords scrapy scraping httpcache selenium
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Scrachy
Scrachy was primarily developed to provide a flexible cache storage backend for [Scrapy](https://scrapy.org/) that stores its data in a relational database using [SQLAlchemy](https://www.sqlalchemy.org/).
However, it now has several other additional features including middleware for using Selenium to download requests.
It also comes with a downloader middleware that will optionally ignore requests that are already in the cache.

# Install
You can install the latest version from git:

```
>pip install git+https://bitbucket.org/reidswanson/scrachy.git
``` 

or from PyPI:

```
>pip install scrachy
```

# Documentation
A brief guide to minimally using the cache storage engine and the Selenium backend are given below.
For other configuration options and features please see the full documentation on [Read the Docs](https://scrachy.readthedocs.io/en/latest).

## Storage Backend
To (minimally) use the storage backend you simply need to enable caching by adding the following to your `settings.py` file:  
```python
# Enable caching
HTTPCACHE_ENABLED = True

# Set the storage backend to the one provided by Scrachy.
HTTPCACHE_STORAGE = 'scrachy.middleware.httpcache.AlchemyCacheStorage'

# One of the supported SqlAlchemy dialects
SCRACHY_DB_DIALECT = '<database-dialect>'

# The name of the driver (that must be installed as an extra) and used.
SCRACHY_DB_DRIVER = '<database-driver>'

# Options for connecting to the database
SCRACHY_DB_HOST = '<database-hostname>'
SCRACHY_DB_PORT = '<database-port>'
SCRACHY_DB_SCHEMA = <database-schema>
SCRACHY_DB_DATABASE = '<database-name>'
SCRACHY_DB_USERNAME = '<username>'

# Note, do not store this value in the settings file. Use an environment
# variable or python-dotenv.
SCRACHY_DB_PASSWORD = '<password>'

# A dictionary of other connection arguments
SCRACHY_DB_CONNECT_ARGS = {}

# there may be a conflict with the compression middleware. If you encounter
# errors either disable it or move it after the caching middleware.
DOWNLOADER_MIDDLEWARES = {
   ...
   'scrapy.downloadermiddlewares.http.compression.HttpCompressionMiddleware': None,
}
```

# Selenium
There are two Selenium middleware classes provided by Scrachy.
To use them, first add one of them to the `DOWNLOADER_MIDDLEWARES`

```python
DOWNLOADER_MIDDLEWARES = {
    ...
    'scrachy.middleware.selenium.SeleniumMiddleware': 800,  # or AsyncSeleniumMiddleware
    ...
}
```

Then in your spider parsing code use a `SeleniumRequest` instead of a `scrapy.http.Request`.


# License
Scrachy is released using the GNU Lesser General Public License.
See the [LICENSE](LICENSE.md) file for more details.
Files that are adapted or use code from other sources are indicated either at the top of the file or at the location of the code snippet.
Some of these files were adapted from code released under a 3-clause BSD license.
Those files should indicate the original copyright in a comment at the top of the file.
See the [BSD_LICENSE](BSD_LICENSE.md) file for details of this license.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "scrachy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "scrapy, scraping, httpcache, selenium",
    "author": null,
    "author_email": "Reid Swanson <reid@reidswanson.com>",
    "download_url": "https://files.pythonhosted.org/packages/4d/60/5c355f8b363c92bbae55202d707fe909f237bdf7dec8ea346589da827bc0/scrachy-0.12.0.tar.gz",
    "platform": null,
    "description": "# Scrachy\nScrachy was primarily developed to provide a flexible cache storage backend for [Scrapy](https://scrapy.org/) that stores its data in a relational database using [SQLAlchemy](https://www.sqlalchemy.org/).\nHowever, it now has several other additional features including middleware for using Selenium to download requests.\nIt also comes with a downloader middleware that will optionally ignore requests that are already in the cache.\n\n# Install\nYou can install the latest version from git:\n\n```\n>pip install git+https://bitbucket.org/reidswanson/scrachy.git\n``` \n\nor from PyPI:\n\n```\n>pip install scrachy\n```\n\n# Documentation\nA brief guide to minimally using the cache storage engine and the Selenium backend are given below.\nFor other configuration options and features please see the full documentation on [Read the Docs](https://scrachy.readthedocs.io/en/latest).\n\n## Storage Backend\nTo (minimally) use the storage backend you simply need to enable caching by adding the following to your `settings.py` file:  \n```python\n# Enable caching\nHTTPCACHE_ENABLED = True\n\n# Set the storage backend to the one provided by Scrachy.\nHTTPCACHE_STORAGE = 'scrachy.middleware.httpcache.AlchemyCacheStorage'\n\n# One of the supported SqlAlchemy dialects\nSCRACHY_DB_DIALECT = '<database-dialect>'\n\n# The name of the driver (that must be installed as an extra) and used.\nSCRACHY_DB_DRIVER = '<database-driver>'\n\n# Options for connecting to the database\nSCRACHY_DB_HOST = '<database-hostname>'\nSCRACHY_DB_PORT = '<database-port>'\nSCRACHY_DB_SCHEMA = <database-schema>\nSCRACHY_DB_DATABASE = '<database-name>'\nSCRACHY_DB_USERNAME = '<username>'\n\n# Note, do not store this value in the settings file. Use an environment\n# variable or python-dotenv.\nSCRACHY_DB_PASSWORD = '<password>'\n\n# A dictionary of other connection arguments\nSCRACHY_DB_CONNECT_ARGS = {}\n\n# there may be a conflict with the compression middleware. If you encounter\n# errors either disable it or move it after the caching middleware.\nDOWNLOADER_MIDDLEWARES = {\n   ...\n   'scrapy.downloadermiddlewares.http.compression.HttpCompressionMiddleware': None,\n}\n```\n\n# Selenium\nThere are two Selenium middleware classes provided by Scrachy.\nTo use them, first add one of them to the `DOWNLOADER_MIDDLEWARES`\n\n```python\nDOWNLOADER_MIDDLEWARES = {\n    ...\n    'scrachy.middleware.selenium.SeleniumMiddleware': 800,  # or AsyncSeleniumMiddleware\n    ...\n}\n```\n\nThen in your spider parsing code use a `SeleniumRequest` instead of a `scrapy.http.Request`.\n\n\n# License\nScrachy is released using the GNU Lesser General Public License.\nSee the [LICENSE](LICENSE.md) file for more details.\nFiles that are adapted or use code from other sources are indicated either at the top of the file or at the location of the code snippet.\nSome of these files were adapted from code released under a 3-clause BSD license.\nThose files should indicate the original copyright in a comment at the top of the file.\nSee the [BSD_LICENSE](BSD_LICENSE.md) file for details of this license.\n",
    "bugtrack_url": null,
    "license": "# GNU LESSER GENERAL PUBLIC LICENSE  Version 3, 29 June 2007  Copyright \u00a9 2007 Free Software Foundation, Inc. <http://fsf.org/>  Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.  This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below.  ## 0. Additional Definitions.  As used herein, \"this License\" refers to version 3 of the GNU Lesser General Public License, and the \"GNU GPL\" refers to version 3 of the GNU General Public License.  \"The Library\" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below.  An \"Application\" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library.  A \"Combined Work\" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the \"Linked Version\".  The \"Minimal Corresponding Source\" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version.  The \"Corresponding Application Code\" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work.  ## 1. Exception to Section 3 of the GNU GPL.  You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL.  ## 2. Conveying Modified Versions.  If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version:  1. under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or 2. under the GNU GPL, with none of the additional permissions of this License applicable to that copy.  ## 3. Object Code Incorporating Material from Library Header Files.  The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following:  1. Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. 2. Accompany the object code with a copy of the GNU GPL and this license document.  ## 4. Combined Works.  You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following:  1. Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. 2. Accompany the Combined Work with a copy of the GNU GPL and this license document. 3. For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. 4. Do one of the following: 1. Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 2. Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. 5. Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4.4.1., the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4.4.2., you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.)  ## 5. Combined Libraries.  You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following:  1. Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. 2. Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.  ## 6. Revised Versions of the GNU Lesser General Public License.  The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.  Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License \"or any later version\" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation.  If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. ",
    "summary": "Enhanced functionality for Scrapy.",
    "version": "0.12.0",
    "project_urls": {
        "Documentation": "https://scrachy.readthedocs.io/en/latest",
        "Homepage": "https://bitbucket.org/reidswanson/scrachy"
    },
    "split_keywords": [
        "scrapy",
        " scraping",
        " httpcache",
        " selenium"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "08459c61991e873c68fd219f8c173b7992bd24d25eade4ee79a43c9bcdaac3a5",
                "md5": "ebf3439ff589524347eeb13324898b17",
                "sha256": "765acd3d4920225f81ada016f6f64e9762a38b045f80087fafbf2cf282b856f8"
            },
            "downloads": -1,
            "filename": "scrachy-0.12.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ebf3439ff589524347eeb13324898b17",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 71140,
            "upload_time": "2024-10-21T22:22:45",
            "upload_time_iso_8601": "2024-10-21T22:22:45.235915Z",
            "url": "https://files.pythonhosted.org/packages/08/45/9c61991e873c68fd219f8c173b7992bd24d25eade4ee79a43c9bcdaac3a5/scrachy-0.12.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4d605c355f8b363c92bbae55202d707fe909f237bdf7dec8ea346589da827bc0",
                "md5": "06bc08ec99d2e11d90ad80efb01b5ff5",
                "sha256": "7701f410b8e5ce21efd320623e7a44ef41d028cb7ed90878d1e1ec0788c23778"
            },
            "downloads": -1,
            "filename": "scrachy-0.12.0.tar.gz",
            "has_sig": false,
            "md5_digest": "06bc08ec99d2e11d90ad80efb01b5ff5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 47767,
            "upload_time": "2024-10-21T22:22:46",
            "upload_time_iso_8601": "2024-10-21T22:22:46.497413Z",
            "url": "https://files.pythonhosted.org/packages/4d/60/5c355f8b363c92bbae55202d707fe909f237bdf7dec8ea346589da827bc0/scrachy-0.12.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-21 22:22:46",
    "github": false,
    "gitlab": false,
    "bitbucket": true,
    "codeberg": false,
    "bitbucket_user": "reidswanson",
    "bitbucket_project": "scrachy",
    "lcname": "scrachy"
}
        
Elapsed time: 0.39304s