Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Philipp Partosch 46a936d7de added all files to project 2 years ago
..
arrivals.md added all files to project 2 years ago
changelog.md added all files to project 2 years ago
departures.md added all files to project 2 years ago
hafas-mgate-api.md added all files to project 2 years ago
journeys-from-trip.md added all files to project 2 years ago
journeys.md added all files to project 2 years ago
lines.md added all files to project 2 years ago
locations.md added all files to project 2 years ago
migrating-to-5.md added all files to project 2 years ago
nearby.md added all files to project 2 years ago
profile-boilerplate.js added all files to project 2 years ago
radar.md added all files to project 2 years ago
reachable-from.md added all files to project 2 years ago
readme.md added all files to project 2 years ago
refresh-journey.md added all files to project 2 years ago
remarks.md added all files to project 2 years ago
server-info.md added all files to project 2 years ago
stop.md added all files to project 2 years ago
trip.md added all files to project 2 years ago
trips-by-name.md added all files to project 2 years ago
writing-a-profile.md added all files to project 2 years ago

readme.md

API documentation

Migrating from an old hafas-client version

Throttling requests

There’s opt-in support for throttling requests to the endpoint.

const createClient = require('hafas-client')
const withThrottling = require('hafas-client/throttle')
const dbProfile = require('hafas-client/p/db')

// create a throttled HAFAS client with Deutsche Bahn profile
const client = createClient(withThrottling(dbProfile), 'my-awesome-program')

// Berlin Jungfernheide to München Hbf
client.journeys('8011167', '8000261', {results: 1})
.then(console.log)
.catch(console.error)

You can pass custom values for the nr of requests (limit) per interval into withThrottling:

// 2 requests per second
const throttledDbProfile = withThrottling(dbProfile, 2, 1000)
const client = createClient(throttledDbProfile, 'my-awesome-program')

Retrying failed requests

There’s opt-in support for retrying failed requests to the endpoint.

const createClient = require('hafas-client')
const withRetrying = require('hafas-client/retry')
const dbProfile = require('hafas-client/p/db')

// create a client with Deutsche Bahn profile that will retry on HAFAS errors
const client = createClient(withRetrying(dbProfile), 'my-awesome-program')

// Berlin Jungfernheide to München Hbf
client.journeys('8011167', '8000261', {results: 1})
.then(console.log)
.catch(console.error)

You can pass custom options into withRetrying. They will be passed into retry.

// retry 2 times, after 10 seconds & 30 seconds
const retryingDbProfile = withRetrying(dbProfile, {
	retries: 2,
	minTimeout: 10 * 1000,
	factor: 3
})
const client = createClient(retryingDbProfile, 'my-awesome-program')

Writing a profile

Check the guide.

General documentation for mgate.exe APIs

hafas-mgate-api.md