background preloader

Www / http / https

Facebook Twitter

Autocomplete. Basic File Uploads. File Upload using AngularJs. TodoMVC. Jkbr/httpie. Dstufft/slumber. Tutorial (web.py) Other languages : chinese 简体中文 | français | Bahasa Indonesia | ... Summary Starting So you know Python and want to make a website. web.py provides the code to make that easy. If you want to do the whole tutorial, you'll need to have installed Python, web.py, flup, psycopg2, and Postgres (or equivalent database and Python driver). (See install for details.)

Let's get started. URL Handling The most important part of any website is its URL structure. To get started with your web.py application, open up a new text file (let's call it code.py) and type: import web This imports the web.py module. Now we need to tell web.py our URL structure. Urls = ( '/', 'index' ) The first part is a regular expressions that matches a URL, like /, /help/faq, /item/(\d+), etc. This line says we want the URL / (i.e. the front page) to be handled by the class named index. GET and POST: the difference Now we need to write the index class. In our web.py code, we make the distinction between the two clear: Start the server.

Pyramid Single File Tasks Tutorial — The Pyramid Tutorials v0.1. This tutorial is intended to provide you with a feel of how a Pyramid web application is created. The tutorial is very short, and focuses on the creation of a minimal todo list application using common idioms. For brevity, the tutorial uses a “single-file” application development approach instead of the more complex (but more common) “scaffolds” described in the main Pyramid documentation. At the end of the tutorial, you’ll have a minimal application which: provides views to list, insert and close tasksuses route patterns to match your URLs to view code functionsuses Mako Templates to render your viewsstores data in an SQLite database Here’s a screenshot of the final application: Step 1 - Organizing The Project Note For help getting Pyramid set up, try the install guide.

To use Mako templates you need to install the pyramid_mako add-on as indicated here. In short, you’ll need to have both the pyramid and pyramid_mako packages installed. /tasks /static /templates Step 2 - Application Setup. WebOb — WSGI request and response objects. Grequest (gevent http get) Scrapy | An open source web scraping framework for Python. Crawl a website with scrapy - *.isBullsh.it. In this article, we are going to see how to scrape information from a website, in particular, from all pages with a common URL pattern. We will see how to do that with Scrapy, a very powerful, and yet simple, scraping and web-crawling framework. For example, you might be interested in scraping information about each article of a blog, and store it information in a database. To achieve such a thing, we will see how to implement a simple spider using Scrapy, which will crawl the blog and store the extracted data into a MongoDB database.

We will consider that you have a working MongoDB server, and that you have installed the pymongo and scrapy python packages, both installable with pip. If you have never toyed around with Scrapy, you should first read this short tutorial. In this example, we’ll see how to extract the following information from each isbullsh.it blogpost : title author tag release date url We’re lucky, all posts have the same URL pattern: Prinzhorn/skrollr.