Skip to main content

data-services-helpers

A module containing classes and functions previously used by The Sensible Code Company's Data Services team.

(The Sensible Code Company is now Cantabular Ltd.)

Warning: This is now in maintenance mode.

It has been updated to work with Python 3.14 but there are no guarantees on future maintenance.

Installation

For the current release:

pip install dshelpers

Usage

batch_processor

with batch_processor(callback_function(), batch_size=2000) as b:
    # loop to make rows here
    b.push(row)

Here, push on the batch_processor queues items in a list. When the context manager is exited, calls the callback_function with the list of items.

Often used to bundle multiple calls to scraperwiki.sqlite.save when saving data to a database.

install_cache

install_cache(expire_after=12 * 3600, cache_post=False)

For installing a requests_cache; requires the requests-cache package.

expire_after is the cache expiry time in seconds.

cache_post defines if HTTP POST requests should be cached as well.

download_url

download_url(url, back_off=True, **kwargs)

Retrieve the content of url, by default using requests.request('GET', url), and return a file-like object. If back_off=True, then this will retry (with backoff) on failure; otherwise, only one attempt is made. Returns the response.content as a StringIO object.

The **kwargs can be arguments that requests recognises, e.g. method or headers.

request_url

request_url(url, back_off=True, **kwargs)

As download_url, but returns the response object.

Tests

Run with make test.

Metadata

Release files for dshelpers 2.0.2

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

Source distribution (sdist)

Source distribution for dshelpers 2.0.2
File Size Uploaded
dshelpers-2.0.2.tar.gz 6.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dshelpers 2.0.2
File Interpreter ABI Platform
dshelpers-2.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 12.1 kB

Release files / dshelpers-2.0.2.tar.gz

Download URL dshelpers-2.0.2.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
652f17f9f210ad07a3b3eed968d4abc6da245f0f0da1307cebe6552bc76f224f
BLAKE2b-256 checksum
How to use checksums
bd9b2ac4db937feccf75984942acd38747ab0493512491bcc4e227f21d0eee92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 8, 2026.

Transparency log

Release files / dshelpers-2.0.2-py3-none-any.whl

Download URL dshelpers-2.0.2-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d8f870995b718c9c2bea23fb45d5df4caba74bfa4070a1f27633de7e25dcc497
BLAKE2b-256 checksum
How to use checksums
19a68a2ec72a28415d7133cf46f71b1e21124a50126422888806a6f341b9862d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 8, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.0.2 This release

2 release files

2.0.1

2 release files

1.3.1

1 release file

1.3.0

1 release file

1.2.0

1 release file

1.1.0

1 release file

1.0.4

1 release file

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