Skip to main content

arcgis-scraper

GitHub release (latest by date) Python 3.6+ License MIT

A simple scraper to download data from ArcGIS FeatureServer and MapServer layers.

Installation

The Python module can be installed in the following ways:

Install from PyPI

pip install --upgrade arcgis-scraper

Install from wheel

If you have downloaded a .whl file from the Releases page, install it with:

pip install path/to/arcgis_scraper‑<version>‑py3‑none‑any.whl

Replace <version> with the actual version number in the filename. For example:

pip install path/to/arcgis_scraper-1.0.1-py3-none-any.whl

Install from source

git clone https://github.com/pgroenbaek/arcgis-scraper.git
pip install --upgrade ./arcgis-scraper

Usage

from arcgisscraper import ArcGISScraper

# Base URL for the ArcGIS REST services
base_url = "https://services1.arcgis.com/QcgJt0vVxSaqMKl7/arcgis/rest/services/"

# List of layers to scrape
query_urls = [
    "Adgangsveje_OD/FeatureServer/0/query",
    "Afsnitsmidter_OD/FeatureServer/0/query",
    "Basisspor_OD/FeatureServer/0/query",
]

# Initialize the scraper
scraper = ArcGISScraper(
    base_url=base_url,
    export_directory="./data",
    export_format="csv", # Options: "csv", "json", "parquet"
    max_requests_per_second=1.0,
    token=None, # Optional: token for secured services
    max_retries=3,
)

# Scrape multiple layers
scraper.scrape_layers(query_urls)

# Scrape a single layer with filtering and custom filename
scraper.scrape_layer(
    "Basisspor_OD/FeatureServer/0/query",
    filename="basisspor_filtered",
    where="SporType='Main'",
    out_fields="ID,Name,SporType"
)

Running Tests

You can run tests manually or use tox to test across multiple Python versions.

Run Tests Manually

First, install the required dependencies:

pip install pytest

Then, run tests with:

pytest

Run Tests with tox

tox allows you to test across multiple Python environments.

1. Install tox

pip install tox

2. Run Tests

tox

This will execute tests in all specified Python versions.

3. tox.ini Configuration

The tox.ini file should be in your project root:

[tox]
envlist = py36, py37, py38, py39, py310

[testenv]
deps = pytest
commands = pytest

Modify envlist to match the Python versions you want to support.

License

This Python module was created by Peter Grønbæk Andersen and is licensed under the MIT License.

Metadata

Release files for arcgis-scraper 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for arcgis-scraper 1.0.1
File Size Uploaded Provenance Actions
arcgis_scraper-1.0.1.tar.gz 7.5 kB Without provenance Details for arcgis_scraper-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for arcgis-scraper 1.0.1
File Interpreter ABI Platform Actions
arcgis_scraper-1.0.1-py3-none-any.whl Python 3 none any Details for arcgis_scraper-1.0.1-py3-none-any.whl

Total release size: 16.2 kB

Release files / arcgis_scraper-1.0.1.tar.gz

Download URL arcgis_scraper-1.0.1.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b68d59df68d57607c50e2185d7732d633e8a83dadad8af023e216e43de9f8a27
BLAKE2b-256 checksum
How to use checksums
36bb118ccf87537741eec0f72f2dfbdaf6911bb43640763d6eaa378dbcf4c65b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / arcgis_scraper-1.0.1-py3-none-any.whl

Download URL arcgis_scraper-1.0.1-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a45770e494091e97e238056b6d11812a2521366319d7440b95f769b820b439ce
BLAKE2b-256 checksum
How to use checksums
8703ad7ad8be2563b888ec25cffb152b49b4e4b01c9ec4ff1a90cd67143fff2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Security for arcgis-scraper 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page