Temboo does lots more than just work with APIs. We've got a growing collection of programming utilities that will make your life much easier. In this tutorial we'll show you how to use these handy code shortcuts by working through a URL encoding example.
You might ask "why is URL encoding important?". Well, URLs can only be sent over the Internet using the ASCII character-set. Since URLs often contain non-ASCII characters, they need to be converted so they only contain valid characters. The general rule is that unsafe characters are replaced with a % followed by two hexadecimal digits. Spaces are replaced by either a plus sign (+) or with %20. You've probably seen URLs full of strange looking characters, and now you know why!
The good news is that you don't actually have to worry about the specifics. Our URL encoding utility will do all the work for you.
3Now let's test the Utilities > Encoding > URLEncode Choreo directly from our website.
4Enter some text that you want to URL encode. It should contain illegal characters, like spaces, accents, and punctuation. Here's some text you can use:
I'm Enc0ding URL$ wITh T3mBo0
5 Click Run and you'll see the the URL encoded result returned by the Choreo.
6 To call the URL encoding Choreo from a Python program, copy the generated code from your browser directly into a new .py file and try running it there. Your code should look something like the script below. Your code should look something like this:
from temboo.Library.Utilities.Encoding import URLEncode from temboo.core.session import TembooSession # Create a session with your Temboo account details session = TembooSession('ACCOUNT_NAME', 'APP_NAME', 'APP_KEY') # Instantiate the Choreo uRLEncodeChoreo = URLEncode(session) # Get an InputSet object for the Choreo uRLEncodeInputs = uRLEncodeChoreo.new_input_set() # Set the Choreo inputs uRLEncodeInputs.set_Text("I'm Enc0ding URL$ wITh T3mBo0") # Execute the Choreo uRLEncodeResults = uRLEncodeChoreo.execute_with_results(uRLEncodeInputs) # Print the Choreo outputs print("URLEncodedText: " + uRLEncodeResults.get_URLEncodedText())
7Run the code and the URL encoded version of the text will be printed in the console.
We're all finished! Now your know about Temboo's range of handy developer utilities and how to access them via our Python SDK. Check out more Python examples to see what else you can do with our Python SDK.
Once you've got your code up and running, you're ready to move on and do more. From monitoring your running applications, to moving your generated Temboo code to your preferred development environment and sharing it with colleagues, collaborators and friends - we've got you covered.
We're always happy to help. Just email us at firstname.lastname@example.org, and we'll answer your questions.