Here in Google App Engines I got this code that would help fetch an HTML code of any web page by its URL:
from google.appengine.api import urlfetch
url = "http://www.google.com/"
result = urlfetch.fetch(url)
if result.status_code == 200:
doSomethingWithResult(result.content)
I don't understand one thing here (among many other things, in fact) why it is suggested in this code to import urlfecth from google.appengine.api ? Does Python not have this command onits own?
Google App Engine makes it easy to use the platform, which offers the flexibility to focus on other concurrent web applications and processes. The best part is that GAE automatically handles the traffic increase through patching, provisioning, and monitoring.
Google App Engine (GAE) is a platform-as-a-service product that provides web app developers and enterprises with access to Google's scalable hosting and tier 1 internet service. GAE requires that applications be written in Java or Python, store data in Google Bigtable and use the Google query language.
The main benefits of Google App Engine are: Open and familiar languages and tools: Users can build and deploy apps quickly using popular languages or bring their own language runtimes and frameworks, they can also manage resources from the command line, debug source code, and run API back ends easily.
js, Java, Ruby, C#, Go, Python, or PHP. A fully managed environment lets you focus on code while App Engine manages infrastructure concerns. Use Cloud Monitoring and Cloud Logging to monitor the health and performance of your app and Cloud Debugger and Error Reporting to diagnose and fix bugs quickly.
Python has libraries such as urllib and httplib for fetching URLs, but on App Engine, all requests must go through the custom urlfetch library. App Engine includes stubs for urllib and httplib that cause them to use urlfetch internally, but if you have a choice, using urlfetch directly is more efficient and flexible.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With