Skip to main content
# WMATA Realtime Snapshot

### Overview

Provide a point-in-time mirror of Washington DC Metro's realtime train schedule

### Installation

1. **Install the package**

```shell
pip install django-wmata-realtime-snapshot
```

1. **Add the app to your django project's settings**

```python
INSTALLED_APPS = (
...
wmata_realtime_snapshot,
)
```

1. **Get a WMATA API key**

If you don't already have a WMATA API account, sign up here: https://developer.wmata.com/signup

Alternatively, you may have success using the demo key provided here: https://developer.wmata.com/Products

Once you have a key, (e.g. `1234IAMAKEY`), you can use it to download a dump of the realtime data.

1. **Download a JSON and/or XML dump from WMATA**

These instructions are for a UNIX based system.

JSON Dump:
```shell
curl https://api.wmata.com/StationPrediction.svc/json/GetPrediction/All?api_key=1234IAMAKEY > realtime_dump.json
```

XML Dump:
```shell
curl https://api.wmata.com/StationPrediction.svc/GetPrediction/All?api_key=1234IAMAKEY > realtime_dump.xml
```

To download both at the same time:

```shell
curl https://api.wmata.com/StationPrediction.svc/json/GetPrediction/All?api_key=1234IAMAKEY > realtime_dump.json & curl https://api.wmata.com/StationPrediction.svc/GetPrediction/All?api_key=1234IAMAKEY > realtime_dump.xml
```

1. **Add your dumps to the Django settings file**

In your Django settings, define the following variables for the dumps you want to serve.

```
WMATA_JSON_DUMP='path/to/realtime_dump.json'
WMATA_XML_DUMP='path/to/realtime_dump.xml'
```

Any endpoint type (json or xml) that does not have a dump file to read will return a json/xml error message when querying the snapshot API:

```json
{"Error": "No JSON resource has been defined. Please read the installation instructions."}
```

```xml
<Error>No XML resource has been defined. Please read the installation instructions.</Error>
```

1. **Add a url endpoint**

```python
url(r'^mirror/', include('wmata_realtime_snapshot.urls', namespace='wmata_realtime_snapshot')),
```

1. **Visit the API**

The API path is the same as the real WMATA API for easy plug-n-play:

```
http://localhost:8000/mirror/StationPrediction.svc/json/GetPrediction/All
http://localhost:8000/mirror/StationPrediction.svc/GetPrediction/B01
http://localhost:8000/mirror/StationPrediction.svc/json/GetPrediction/K08,D13,A05
```

Metadata

Release files for django-wmata-realtime-snapshot 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 django-wmata-realtime-snapshot 0.2
File Size Uploaded Provenance Actions
django-wmata-realtime-snapshot-0.2.tar.gz 3.3 kB Without provenance Details for django-wmata-realtime-snapshot-0.2.tar.gz

Release files / django-wmata-realtime-snapshot-0.2.tar.gz

Download URL django-wmata-realtime-snapshot-0.2.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3961107bb0dfb0692eb66f7762ebc618e51d08c906ffde5e2665894127ae7469
BLAKE2b-256 checksum
How to use checksums
bff26d0fb087eaf90fabc14c6faab13a734c29fa94b44df9bc80df3074c36e58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-wmata-realtime-snapshot 0.2

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.

Release history Release notifications | RSS feed

This release

0.2 This release

1 release file No provenance

0.1

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