Skip to content
Cameron edited this page Dec 4, 2024 · 19 revisions

Setting up the realtime-trains-py package

Depending on how you want to run the package, there are a few things that you need to do before you can start using the package. To get help that's specific to your needs, click one of the links below to get directed to the right place.

I've forked, cloned or downloaded this repository onto my device

Forking, cloning or downloading this repository onto your device allows you to edit the code to suit your own personal needs. This also allows you to contribute to the repository by submitting a pull request. This setup option is recommended for users that have a good understanding of python.

I've installed the package using pip

Installing this package using pip is the recommended option, as pip will have the most up-to-date code and be 100% what you see on this repository. This setup option is recommended for users that do not have a good understand of python.


Setting up the package locally

Running the realtime-trains-py package locally will require you to implement a few things before you can start.

To start, you need to initialise the package in your file. To do this, you'll need to make a new python file: your_file.py. In this file, you'll need to import realtime_trains_py and assign RealtimeTrainsPy() to a variable of your choosing, like below.

from realtime_trains_py import RealtimeTrainsPy

your_var = RealtimeTrainsPy()

When you initialise RealtimeTrainsPy(), you can provide between zero (0) and three (3) arguments. These are:

Don't have a username or password?

Caution

Keep your username and password private.

Warning

If you would like to contribute to this project by submitting a pull request, please ensure that your local copy of the repository is thoroughly reviewed and free of any sensitive or personal information. This includes, but is not limited to, usernames, passwords, API keys, or any other credentials that might compromise your security or the integrity of the repository.

Keep in mind that all pull requests are public and can be viewed by anyone on the internet once submitted. To protect your privacy and maintain the security of your systems, double-check your code and configuration files before making any changes public.
Not all submitted pull requests will be merged onto the main branch

By following these guidelines, you help keep the project secure and maintain a professional standard for collaboration within the community. If you are unsure about the process or need assistance, feel free to check the GitHub documentation on pull requests or reach out to the repository maintainers for guidance.


Finally, to start using the package locally, it is recommended that you create a separate folder called tests for your code. You should start any new file you create with:

from realtime_trains_py import RealtimeTrainsPy

your_var = RealtimeTrainsPy()

This will allow you to begin using the package. View our documentation for step-by-step guides on how to do this.

Your final step is the try running the program. If you have followed this setup guide correctly, you shouldn't receive any errors. If you receive an error, re-read the setup guide and report an issue with realtime-trains-py on GitHub so that we can check our systems.

That's all you need to know to set up the package locally on your device. Any other queries you have will likely have answers already on this wiki. If you're still unsure, head to either the discussions or issues page to check for community-created answers.


Setting up the package using pip

Running the realtime-trains-py package using pip will require you to implement a few things before you can start.

To start, you need to initialise the package in your file. To do this, you'll need to make a new python file: your_file.py. In this file, you'll need to import realtime_trains_py and assign RealtimeTrainsPy() to a variable of your choosing, like below.

from realtime_trains_py import RealtimeTrainsPy

your_var = RealtimeTrainsPy()

When you initialise RealtimeTrainsPy(), you can provide between zero (0) and three (3) arguments. These are:

Don't have a username or password?

Important

Make sure you provide both your username and password together, or you won't be able to access the API.

Caution

Keep your username and password private.

This will allow you to begin using the package. View our documentation for step-by-step guides on how to do this.

Your final step is the try running the program. If you have followed this setup guide correctly, you shouldn't receive any errors. If you receive an error, re-read the setup guide and report an issue with realtime-trains-py on GitHub so that we can check our systems.

That's all you need to know to set up the package using pip. Any other queries you have will likely have answers already on this wiki. If you're still unsure, head to either the discussions or issues page to check for community-created answers.


I don't have a username or password

To get a username and password, head over to the api portal and select register. Follow the appropriate steps on the site. Once logged in, you'll be directed to the API home page. This page shows you your API auth credentials - these are the details you'll use to access the API. Your username is prefixed with rttapi_ and your password will be a 40 character hex string. Copy these details and paste them into your code.

Caution

Keep your username and password private.

Clone this wiki locally