PyTransportNSWv2 0.4.0

pip install PyTransportNSWv2 Copy PIP instructions

Released: May 28, 2024

Get detailed per-trip transport information from TransportNSW

Verified details

Maintainers.

Avatar for andystewart999 from gravatar.com

Unverified details

Project links, github statistics.

  • Open issues:

View statistics for this project via Libraries.io , or by using our public dataset on Google BigQuery

License: MIT License

Author: andystewart999

Classifiers

  • OSI Approved :: MIT License
  • OS Independent
  • Python :: 3
  • Software Development :: Libraries :: Python Modules

Project description

Transportnsw.

Python lib to access Transport NSW information.

Get an API Key

An OpenData account and API key is required to request the data. More information on how to create the free account can be found here: https://opendata.transport.nsw.gov.au/user-guide . You need to register an application that needs both the Trip Planner and Realtime Vehicle Positions APIs

Get the stop IDs

The function needs the stop IDs for the source and destination, and optionally how many minutes from now the departure should be, and if you want to filter trips by a specific transport type. The easiest way to get the stop ID is via https://transportnsw.info/stops#/ . It provides the option to search for either a location or a specific platform, bus stop or ferry wharf. Regardless of if you specify a general location for the origin or destination, the return information shows the stop_id for the actual arrival and destination platform, bus stop or ferry wharf.

If it's available, the general occupancy level and the latitude and longitude of the selected journey's vehicle (train, bus, etc) will be returned.

API Documentation

The source API details can be found here: https://opendata.transport.nsw.gov.au/sites/default/files/2023-08/Trip%20Planner%20API%20manual-opendataproduction%20v3.2.pdf

TransportNSW's trip planner can work better if you use the general location IDs (eg Central Station) rather than a specific Stop ID (eg Central Station, Platform 19) for the destination, depending on the transport type. Forcing a specific end destination sometimes results in much more complicated trips. Also note that the API expects (and returns) the Stop IDs as strings, although so far they all appear to be numeric.

transport_type filters

If you call the function with a transport_type filter and set strict_transport_type to True , only journeys whose first leg matches the desired filter will be considered. Otherwise the filter includes a journey if any of the legs includes the desired travel type.

raw_output simply returns the entire API response string as JSON, without making any changes to it.

Sample Code

The following example will return the next trip that starts from Pymble Station (207310) five minutes from now, to Gordon Station (207210). Note that specific platforms, such as Gordon Station, Platform 3 (207263) haven't been specified so any platform combination will be accepted:

Unless raw_output is True , the return output always returns an array of journeys, even if journeys_to_return is 1. The journey array is preceded by how many journeys were requested, and how many were actually returned that contained usable data:

Fun fact: TransportNSW's raw API output calls itself JSON, but it uses single quotes for strings in defiance of the JSON standards. When using this wrapper the output is formatted such that jq , for example, is happy with it.

  • due: the time (in minutes) before the journey starts
  • origin_stop_id: the specific departure stop id
  • origin_name: the name of the departure location
  • departure_time: the departure time, in UTC
  • destination_stop_id: the specific destination stop id
  • destination_name: the name of the destination location
  • arrival_time: the planned arrival time at the origin, in UTC
  • origin_transport_type: the type of transport, eg train, bus, ferry etc
  • origin_transport_name: the full name of the transport provider
  • origin_line_name & origin_line_name_short: the full and short names of the journey
  • changes: how many transport changes are needed on the journey
  • occupancy: how full the vehicle is, if available
  • real_time_trip_id: the unique TransportNSW id for that specific journey, if available
  • latitude & longitude: The location of the vehicle, if available

Please note that the origin and destination detail is just that - information about the first and last stops on the journey at the time the request was made. We don't return any intermediate steps, transport change types etc other than the total number of changes - the assumption is that you'll know the details of your specified trip, you just want to know when the next departure is. If you need much more detailed information then I recommend that you use the full Transport NSW trip planner website or application.

Thank you Dav0815 for your TransportNSW library that the vast majority of this fork is based on. I couldn't have done it without you! https://github.com/Dav0815/TransportNSW

Project details

Release history release notifications | rss feed.

May 28, 2024

May 21, 2024

May 20, 2024

May 17, 2024

Jun 28, 2020

0.2.3 yanked

Reason this release was yanked:

Found a fatal error

Jun 18, 2020

Jun 17, 2020

0.2.0 yanked

Jun 14, 2020

There's a typo in __init__.py that I haven't fixed yet.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages .

Source Distribution

Uploaded May 28, 2024 Source

Built Distribution

Uploaded May 28, 2024 Python 3

Hashes for pytransportnswv2-0.4.0.tar.gz

Hashes for pytransportnswv2-0.4.0-py3-none-any.whl.

  • português (Brasil)

Supported by

transport nsw trip planner api

Open Net Zero logo

Trip Planner APIs

Update frequency

Last updated.

7 months ago

api PDF CSV

Additional Information

The Opal Fare component of the Trip Planner /trip API is no longer supported 16 October 2023.

Trip Planner API Technical Documentation

Stop EFA ID to TSN Mapping Table

A mapping table of system derived EFA stop IDs to Global ID/Transit Stop Numbers (TSN).

Share This Dataset

Copy path url

Transport for NSW

Access and licensing, access conditions.

Access control: Unknown

Licence conditions

Licence: Creative Commons Attribution

Trip Planner API - web interface options (transport modes & to/from transport)

Is it possible to specify options available through the Trip Planner web interface when using the Trip Planner API: Modes of transport - web interface can select/deselect Train/Bus/Ferry/School Bus etc. Walk speed - web interface can select Slow/Normal/Fast To and from transport - web interface can choose Walk (with time limit) or Taxi/Drive

The Trip Planner API does not seem to have parameters for these options.I would like to exclude School Bus and Coach and select Taxi/Drive when doing the trip planning. Thanks.

Yes, these parameters can definitely be set. I thought they would be in the API documentation but can’t see it - let me check with some people and I’ll get back to you.

Sorry for the delay. We will update the documentation to include these options.

Hi Tim The documentation for the API has now been updated to include the options you asked about. Let me know if there’s anything else you would like to know! Vic

Related Topics

transport nsw trip planner api

Trip Planner APIs

Licence & rights:.

CC-BY

Creative Commons Attribution http://www.opendefinition.org/licenses/cc-by

Contact Information

Brief description, full description, this dataset is part of a larger collection, related organisations.

  • Owner Transport for NSW

User Contributed Tags    

Login to tag this record with meaningful keywords to make it easier to discover

  • Local : b4ea9f45-2778-47b7-ab3d-de3b7cc98c19
  • 'Weather at Home' project data
  • 'Seeds for Snapper' 2021 Posidonia fruit collection data (NESP MaC 1.8)
  • Public Transport - Realtime Trip Update

A NSW Government website

transport nsw trip planner api

Explore Metadata

  • ISO19115/ISO19139 XML

Data and Resources

  • More information
  • Go to resource

Additional Info

  • MyServiceNSW
  • Manage account
  • Logout of MyServiceNSW

Testing and what to do if you have COVID-19

How to get a test if you think you might have COVID-19, and what to do if you test positive.

Mum with toddler checking thermometer

COVID-19 update – 6 June 2024

COVID-19 is at high levels in the community.

Read the latest  data from NSW Health .

Continue to protect other people. Please stay home if you have any cold or flu symptoms. Wear a mask if you need to leave home.

Learn how to  keep yourself and others COVID-safe . 

Icon Testing Health

Getting a test for COVID-19 

Which covid test should i do.

Guidance on which test is best for you.

Information for people exposed to COVID-19

Understand your risk and what you can do to protect yourself and your loved ones. 

Symptoms and how it spreads

Learn about the symptoms of COVID-19, when they appear and how it spreads.

Advice for higher risk groups

Some people are at higher risk of severe illness from COVID-19. Find information on how to protect yourself and others from becoming very unwell.

If you're at higher risk of severe illness, talk to your doctor about PCR tests.

protect yourself and others

Managing your COVID-19 illness

What to do if you test positive.

Advice on how you can safely manage mild symptoms at home.

Antiviral medicines

Find out if you're eligible for antiviral medicines and how to access them.

Information on long-term symptoms you may experience due to  COVID-19, and where to seek support.

COVID-19 guidance for families

Advice for parents and carers on COVID safety in schools and early childhood education services.

Advice for workers

What to do if you test positive and information about returning to work.

Guidance for businesses

What you need to do as an employer to manage the risk to colleagues and customers.

Easy Read and in-language resources

Easy read information on covid-19, in-language and translated covid-19 support, contact us and find translation help.

  • Service NSW – information and advice for NSW residents and businesses. Phone  13 77 88
  • Healthdirect – government-funded 24-hour health advice. Phone 1800 022 222
  • Disability Gateway – information for people with disability. Phone 1800 643 787
  • Mental health support, services and programs
  • Service NSW Savings Finder – find rebates and vouchers relevant to you
  • Business Concierge – tailored advice from Business Connect advisors. Phone 13 77 88
  • Translating and Interpreting Service (TIS National) – free service provided by the Australian Government. Phone 13 14 50

Switch to Sydney.com to see more of our capital city

  • Accommodation
  • Travel Inspiration

Feel NSW

Visitnsw Home Page

Nsw, australia.

Welcome to New South Wales – a place to feel free, feel alive, feel new. As the official tourism, destinations and events website, let us inspire your next travel tale.

Follow rainforest birdsong to thundering waterfalls. Glide down glittering snowfields or slip into the silken sea on a white-sand beach. Taste world-class wines, ocean-fresh oysters, juicy cherries and fragrant truffles on meandering road trips. Connect with outback stories, making new friends along the way. So, where to first?

Places to go

Lowe Wines in Mudgee

Country NSW

Hot air ballooning in the Hunter Valley

Hunter Valley

Three Sisters - Blue Mountains

Blue Mountains

Hyams Beach in Jervis Bay - South Coast. Credit: Jordan Robins

South Coast

Toowoon Bay - Central Coast

Central Coast

Kangaroos at Emerald Beach during sunrise, Coffs Coast

North Coast

Spectacular outback landscapes showcasing the Walls of China in the World Heritage Mungo National Park

Outback NSW

Sunrise at Australian Highest lifted point, Thredbo

Snowy Mountains

Capella Lodge - Lord Howe Island

Lord Howe Island

Sydney Opera House

Must-see events

Start planning your winter getaway.

Gawthorne's Hut at Wilgowrah - Credit: SM Gordon & TR Gordon

Holiday spots with epic fireplaces

Plate of freshly picked truffles at Lowes Mount Truffiere, Oberon

Where to go truffle hunting

Luxury Glamping Experience at Sierra Escape, Mudgee

Cosy winter stays in NSW

Yarrangobilly Caves thermal pool, Kosciuszko National Park - Credit: Boen Ferguson, DPE

Hot springs worth travelling for

Families skating on the ice rink at Festival of W, Wagga Wagga

5 winter road trips to tick off

Humpback Whale breaching off Point Plomer, Port Macquarie

A guide to whale watching

Have you ticked off these nsw bucket-list experiences.

Snorkelling at Lord Howe Island

Snorkel the world’s southernmost coral reef

The Pool of Reflections in the River Cave, within the iconic Jenolan Caves - Credit: Timeless Creations - Jenolan Caves Reserve Trust

Walk through the world’s most ancient open caves

Couple watching the sun set at the summit of Mount Kosciuszko in Kosciuszko National Park

Stand atop Australia’s highest peak

Spectacular outback landscapes showcasing the Walls of China in the World Heritage Mungo National Park, Outback N

Step back in time at Mungo National Park

Couple enjoying a sandboarding experience at Stockton Sand Dunes located in the Worimi Conservation Lands

Surf the largest sand dunes in the Southern Hemisphere

Warrumbungle National Park

Stargaze at the country’s first Dark Sky Park

tour with Dive Jervis Bay - South Coast

Get up close to humpback whales during the annual migration

Tourists watching the Scenic Railway train descending the Jamison Valley at Scenic World, Katoomba in the Blue Mountains

Ride the world’s steepest railway

Views of Kanangra-Boyd National Park, Blue Mountains

Marvel at NSW’s six UNESCO World Heritage Sites

Friends enjoying wine in the vineyard at Hope Estate, Hunter Valley

Sip your way through Australia's oldest wine region

Hyams Beach in Jervis Bay - South Coast. Credit: Jordan Robins

Sink your toes into the whitest sand in the world

Aboriginal Smoking Ceremony, Wilcannia

Learn about Aboriginal culture with a guide

Dolphin Swim Australia, Port Stephens - Credit: Dolphin Swim Australia

Go diving with turtles, seals & dolphins

Enjoying the outdoor bath at Sierra Escape - Mudgee

Go off-grid on a glamping retreat

Sunrise at Curracurrong Falls and Eagle Rock in the Royal National Park, Sydney

Chase NSW's most incredible waterfalls

Water plume spouting from the Kiama Blowhole, Kiama

Get soaked by the largest blowhole in the world

Latest articles view all.

The Big Banana Fun Park - Credit: Gethin Coles | The Big Banana Pty Ltd

20 of NSW’s most iconic ‘Big Things’

Woman enjoying Bubbletent Australia's outdoor bathtub with scenic views, Capertee Valley

A wellness guide to the Blue Mountains

Girl eating dragonfruit at Tropical Fruit World, Duranbah

Top food adventures for kids in Sydney and NSW

It’s time to hit the road. Our trip planner and interactive map lets you explore the wonders of NSW from coast to country.

Go north along the Legendary Pacific Coast

Grand Pacific Drive

Beaches and national parks on the Grand Pacific Drive

Scenic shot of Dangar Falls, near Dorrigo, North Coast

Chasing waterfalls in lush rainforest

Barrels in Lowe Wines - Mudgee, Country NSW

Gourmet delights on a country Food and Wine Trail

Fur seal swimming around Montague Island, Narooma, South Coast

Follow the coast from Sydney to Melbourne

Sunset Strip in Lake Menindee

Outback adventures on the Darling River Run

More about new south wales.

The most visited state in the nation is home to Sydney , Australia’s most beautiful capital city. There are transport options from Sydney to the marvellous destinations and fun adventures in the regions. There are trains and coaches, as well as flights from Sydney Airport to many regional airports.

What about getting to an island paradise? The UNESCO World Heritage-listed Lord Howe Island is only a short plane trip from the mainland. A top destination all year, the island is home to the world’s most southerly coral reefs, as well as lovely beaches and great fishing, snorkelling and diving.

Wondering where to stay in NSW? Then search the accommodation on the website. There are options to suit various budgets, including camping and caravanning, B&Bs, classic pubs, motels, heritage guesthouses and farm stays, as well as eco-retreats, luxury hotels and spa resorts.

The following pages will also help you plan your holidays, short breaks and weekend escapes:

  • Places to stay
  • Things to do
  • Places to visit
  • Hire cars, kayaks and other things

Subscribe to our newsletter

Stay connected to Visit NSW for all the latest news, stories, upcoming events and travel inspiration.

Discover Somewhere New

All the insider news, tips and inspiration you need to plan your next trip, delivered straight to your inbox.

Destination NSW acknowledges and respects Aboriginal people as the state’s first people and nations and recognises Aboriginal people as the Traditional Owners and occupants of New South Wales land and water.

  • NSW Government
  • Destination New South Wales (Corporate site)

VisitNSW.com is the official tourism site for Destination NSW. © Copyright 2024 Destination NSW. All rights reserved

How can we help you today?

Popular searches.

  • Contactless payments
  • Routes and timetables
  • Concessions
  • School student travel
  • Opal Travel app

Travel alerts

Keep updated on trackwork.

  • Subscribe to trackwork alerts
  • Future planned trackwork
  • About trackwork

IMAGES

  1. Developers and site owners

    transport nsw trip planner api

  2. How to use the Trip Planner

    transport nsw trip planner api

  3. Trip Planner

    transport nsw trip planner api

  4. ‎Trip Planner

    transport nsw trip planner api

  5. My Journey Planner Nsw

    transport nsw trip planner api

  6. Trip Planner

    transport nsw trip planner api

VIDEO

  1. UnTrade Tutorial: How to Connect Binance API with UnTrade App #untrade #UnTrade #Untrade

COMMENTS

  1. Trip Planner APIs

    Trip Planner API to interact with the Transport for NSW trip planner. This allows users to search for trips, stops, service alerts, places of interest. The Trip Planner API offers five different endpoints: Stop Finder, Trip Planner, Departure, Service Alerts and Coordinate Request APIs. You can find more information about each of these below.

  2. Trip Planner

    Use the Trip Planner to plan a trip on public transport by metro, train, bus, ferry, light rail, coach or by walking, cycling, taxi or rideshare anywhere in Sydney and NSW, with real-time information where available. ... Plan your travel in NSW using the Trip Planner or apps, check timetables and travel alerts and find information on stations ...

  3. Developers and site owners

    Developers and site owners. These digital brand guidelines are designed to help you promote transportnsw.info and to ensure your customers have access to the most up-to-date public transport information. Transport for NSW provides access to public transport data through the Open Data Program. The Open Data Hub and Developer Portal provides ...

  4. How to Use Open Data to Develop an Application

    1.0 Our APIs and Data Feeds. You can find all our data, including APIs, in the data catalogue on the Open Data Hub. Some of the main APIs include public transport data, live traffic, trip planning and boating. To build a public transport app there are key APIs that you need to learn to use. The following APIs are commonly used to build a public ...

  5. PyTransportNSWv2 · PyPI

    The source API details can be found here: https: ... If you need much more detailed information then I recommend that you use the full Transport NSW trip planner website or application. Thank you. Thank you Dav0815 for your TransportNSW library that the vast majority of this fork is based on. I couldn't have done it without you!

  6. Trip Planner APIs

    The Opal Fare component of the Trip Planner /trip API is no longer supported 16 October 2023. OpenAPI Console Open in new tab Embed ... Provides capability to provide NSW public transport trip plan options, including walking and driving legs and real-time information. Models. AdditionalInfoResponse.

  7. Trip Planner APIs, a dataset from Transport for NSW

    Trip Planner API to interact with the Transport for NSW trip planner. This allows users to search for trips, stops, service alerts, places of interest. The Trip Planner API offers five different endpoints: Stop Finder, Trip Planner, Departure, Service Alerts and Coordinate Request APIs. You can find more information about each of these below.

  8. Trip Planner API

    Is it possible to specify options available through the Trip Planner web interface when using the Trip Planner API: Modes of transport - web interface can select/deselect Train/Bus/Ferry/School Bus etc. Walk speed - web interface can select Slow/Normal/Fast To and from transport - web interface can choose Walk (with time limit) or Taxi/Drive The Trip Planner API does not seem to have ...

  9. Digital tools to help you plan trips

    Any time of day, wherever you're going, there's a transport trip planning tool to get you there. Any time of day, wherever you're going, there's a transport trip planning tool to get you there. ... Plan. Plan your travel in NSW using the Trip Planner or apps, check timetables and travel alerts and find information on stations, stops, wharves ...

  10. Trip Planner APIs

    Create your own personal public transport trip planner. APIs interact with the transportnsw.info trip planner and provide the ability for NSW public transport trip planning, departure board, travel alerts, real-time transport services and walk and drive legs.\\r\\n\\r\\n\\r\\nTrip Planner API to interact with the Transport for NSW trip planner. This allows users to search for trips, stops ...

  11. Transport apps

    TripView. TripView creates trip plans for metro, train, bus, ferry, light rail and coach services. Plan your trip based on stations, stops and wharves. For bus travel, you can search by route, suburb or stop. It will list all timetabled services with real-time data. Find the right transport app to plan your trip using your smartphone or tablet.

  12. Trip Planner APIs

    Create your own personal public transport trip planner. APIs interact with the transportnsw.info trip planner and provide the ability for NSW public transport trip planning, departure board, travel alerts, real-time transport services, walk and drive legs and Opal fares. Trip Planner API to interact with the Transport for NSW trip planner.

  13. How to use the Trip Planner

    Plan. Plan your travel in NSW using the Trip Planner or apps, check timetables and travel alerts and find information on stations, stops, wharves and how to get to events. ... Contact Transport for NSW for information, feedback, lost property, Opal customer care or regional bookings or follow us on social media. Help with using the Trip Planner ...

  14. Dataset

    Public Transport - Realtime Trip Update v2 Stop time updates for active trips, replacement vehicles, and changed stopping patterns in GTFS-realtime format for Metro and Sydney Trains. api

  15. Plan

    Plan your travel in NSW using the Trip Planner, apps, timetables, travel alerts and find information on stations, stops, wharves and how to get to events ... Use the Trip Planner to plan a public transport trip, now with real time. Departures. See the next services leaving from your station, stop or wharf, in real-time.

  16. Plan your trip as Vivid Sydney lights up the long weekend

    Published 6 Jun 2024. Visitors heading to Vivid Sydney over the long weekend should plan ahead, as Transport for NSW anticipates large crowds to flock to the city on public transport. Transport for NSW Coordinator-General Howard Collins said there will be plenty of extra services, but passengers should plan their trip and allow extra travel time.

  17. Testing and what to do if you have COVID-19

    Contacts and enquiries. Service NSW - information and advice for NSW residents and businesses. Phone 13 77 88. Healthdirect - government-funded 24-hour health advice. Phone 1800 022 222.

  18. New South Wales, Australia

    NSW, Australia. Welcome to New South Wales - a place to feel free, feel alive, feel new. As the official tourism, destinations and events website, let us inspire your next travel tale. Read more.

  19. Travel alerts

    Plan. Plan your travel in NSW using the Trip Planner or apps, check timetables and travel alerts and find information on stations, stops, wharves and how to get to events. ... Contact Transport for NSW for information, feedback, lost property, Opal customer care or regional bookings or follow us on social media. Help with using the Trip Planner ...