Skip to content
anonymous44401 edited this page Jan 11, 2025 · 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.

Let's get started!

Before you start, you need to make sure the package is installed on your machine. Make sure you're running the latest version for the most optimised experience. To install, simply run:

pip install --upgrade realtime-trains-py

You can run this in your termianal.

You will need to install some external required packages for the package to work. These include:

  • tabulate (required)
  • requests (required)

To install these, run:

pip install --upgrade [package]

Make sure you change [package] to either tabulate or requests. You can also run these commands in your terminal


Initialising

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 needs. This also allows you to contribute to the repository by submitting a pull request. This setup option is recommended for users who have a very good understanding of Python.

I'm using the package in my terminal

Installing this package using pip in your terminal is a great option, as the 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 who have a good understanding of Python.

I'm using the package in a file

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 who do not have a good understanding 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 create a new Python file called [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 0 and 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 into 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 in your terminal

When you open your terminal, make sure you're running python, or you won't be able to do anything. You can do this by simply typing python and pressing enter.

Start by typing the following line into your terminal. Make sure you click enter afterwards.

from realtime_trains_py import RealtimeTrainsPy

For the next part, you'll need a username and password. I don't have a username or password.

Run the command below - make sure you change the credentials to your ones or you'll get an error when you try running the code later.

rtt = RealtimeTrainsPy(username = "[your_username]", password = "[your_password]", complexity = "[select_type]")

When you initialise the package, you can provide between 0 and 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 in a file. 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 in a file

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 create a new Python file called [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 the package, you can provide between 0 and 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 in a file. 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