As mentioned in a previous blog, I had included the Tweepy API for my Embedded Systems coursework. This online API, provided by Twitter, allows users to use Twitter via a Python script. One would need to import the tweepy library (so as to access said API) and the access tokens, these can be acquired upon registering for Twitter for Developers. I have tested this feature on both Windows and Linux respectively, I may test it in on macOS as well.
Download Python
You will not be able to install the tweepy module if Python is not installed. Visit the link below to download the latest version of Python. Make sure you add the path at which Python is installed to environment variables within System in the Control Panel.
https://www.python.org/downloads/release/python-373/
Installing the tweepy module

NOTE: There were issues with Python v. 3.7.2!

Getting our hands dirty with Python
The inline documentation (the statements in red which in Python are known as comments, the compiler will ignore said statements) helps demystify what may be deemed perplexing and intimidating to beginners. Comments usually explain what the code is supposed to do and why.
The invoke_error function handles run-time errors (when the program crashes amidst execution due to scenarios the program is not meant to cater for, such as division by zero, specifying invalid paths, entering textual data in fields that only accept numerical data, etc). What it does is display an error message instead of simply allowing the program to crash.
The try block contains code that may trigger a run-time error, whereas the except block contains code that handles errors of the sort. (the finally block contains code that runs irregardless of the outcome)
The authentication details have been hidden for security reasons. (REMEMBER TO NEVER DISCLOSE ANY OF THE FOUR TOKENS, THESE ARE USED TO GAIN ACCESS TO YOUR TWITTER ACCOUNT!)
Running and testing
It is common that code may not compile successfully on first try (much to your chagrin), do not take anything by it. Sift through the code for any potential silly mistakes (bear in mind that Python is case-sensitive, as are most other programming languages such as C# and Java. You will encounter a syntax error if there are any misspelled keywords), lack of/unexpected indentation and unclosed blocks of code among others) and press F5 to run again.


If all goes well, you should see the status on your Twitter page upon being notified that the status has been uploaded.
Stay tuned for more updates!



