background preloader

Python

Facebook Twitter

Python Extension Packages for Windows - Christoph Gohlke. By Christoph Gohlke, Laboratory for Fluorescence Dynamics, University of California, Irvine.

Python Extension Packages for Windows - Christoph Gohlke

This page provides 32- and 64-bit Windows binaries of many scientific open-source extension packages for the official CPython distribution of the Python programming language. The files are unofficial (meaning: informal, unrecognized, personal, unsupported, no warranty, no liability, provided "as is") and made available for testing and evaluation purposes. Building Web Applications with Django and AngularJS. In this tutorial you will build a simplified Google+ clone called “Not Google Plus” with Django and AngularJS.

Building Web Applications with Django and AngularJS

Before we hit the proverbial books and learn to build a rich, modern web application with Django and Angular, let's take a moment to explore the motivations behind this tutorial and how you can get the most out of it. What is the goal of this tutorial? Here at Thinkster, we strive to create high value, in depth content while maintaining a low barrier to entry. Violent-py. Installer Python 2.7.x sur CentOS 6.x les doigts dans le nez. J’ai la vieille habitude de bosser sur CentOS pour des raisons personnelles absolument infondées et grotesques mais les habitudes ont la vie dure comme on dit.

Installer Python 2.7.x sur CentOS 6.x les doigts dans le nez

Et ainsi va la vie, qui évolue au fil du temps, et python aussi, et les apps aussi, et un jour il faut pour des raisons de vie ou de mort passer à une version plus récente de Python. Sam a tenté cette folie il y a quelques temps, avec comme seules réserves un pot de glace ben&jerry et un ouvre-boîte à bouteilles. Bien mal lui en a pris, il a passé des heures sur le serveur, a tout pété et a fini sous exomil. Suite à ça je n’ai jamais osé tenter le coup jusqu’à hier, en tombant sur cet article que je me propose de vous traduire. Emulating a Browser in Python with mechanize. Crawling anonymously with Tor in Python – S Acharya. There are a lot of valid usecases when you need to protect your identity while communicating over the public internet.

Crawling anonymously with Tor in Python – S Acharya

It is 2013 and so you probably already know about Tor. Most people use Tor through the browser. The cool thing is that you can get access to the Tor network programmatically so you can build interesting tools with privacy built into it. □ A simple Django example with Ajax. Django returning JSON for AJAX requests – Rayed's Real Life. KSSInDjango. What is KSS?

KSSInDjango

¶ KSS means Kinetic Style Sheets. A beautiful AJAX framework. A KSS definition taken from ​KSS project site: Django tips: A simple AJAX example, part 1. One thing that’s come up over and over again in the Django IRC channel and on the mailing lists is the need for good examples of “how to do AJAX with Django”.

Django tips: A simple AJAX example, part 1

Now, one of my goals in life at the moment is to try to fill in the gaps in Django’s documentation, so… Over the next couple of entries we’re going to walk through a very simple form, which will submit via AJAX to a Django view and handle the result without a page refresh. If you’d like, you can go ahead and take a look at the form we’ll be building; it’s nothing fancy, but it’s enough to cover most of the bases.

Make sure to try leaving fields blank, filling in an incorrect total in the second field, etc. Django and AJAX Form Submissions - say 'goodbye' to the page refresh. This is a collaboration piece between Real Python and the mighty Nathan Nichols, using a collaborative method we have dubbed ‘agile blogging`.

Django and AJAX Form Submissions - say 'goodbye' to the page refresh

Say ‘hi’ @natsamnic. Let’s get down to business: Download the compressed pre-ajax Django Project from the repoActivate a virtualenvInstall the requirementsSync the databaseFire up the server. Mechanize. Stateful programmatic web browsing in Python, after Andy Lester’s Perl module WWW::Mechanize.

mechanize

The examples below are written for a website that does not exist (example.com), so cannot be run. There are also some working examples that you can run. import reimport mechanize br = mechanize.Browser()br.open(" follow second link with element text matching regular expressionresponse1 = br.follow_link(text_regex=r"cheese\s*shop", nr=1)assert br.viewing_html()print br.title()print response1.geturl()print response1.info() # headersprint response1.read() # body. Custom template tags and filters. Django’s template language comes with a wide variety of built-in tags and filters designed to address the presentation logic needs of your application.

Custom template tags and filters

Nevertheless, you may find yourself needing functionality that is not covered by the core set of template primitives. You can extend the template engine by defining custom tags and filters using Python, and then make them available to your templates using the {% load %} tag. Code layout¶ The most common place to specify custom template tags and filters is inside a Django app. Can I use Django template tags in JavaScript? Python. Learn Python The Hard Way. Expert Python programming. Keyboard Shortcuts You Cannot Miss. IntelliJ IDEA and Eclipse Shortcuts.

Test script showing usage of a buffering SMTP handler. Logging HOWTO — Python 2.7.11 documentation. Basic Logging Tutorial.

Logging HOWTO — Python 2.7.11 documentation

Écrire des logs en Python. Good morning… Au lieu de mettre des print() partout qu’il va falloir retirer après et qui en plus ne servent à rien dans un processus daemonisé, utiliser les facilités de logging de Python peut se révéler un bon investissement. 15.4. argparse — Parser for command-line options, arguments and sub-commands. The argparse module makes it easy to write user-friendly command-line interfaces. The program defines what arguments it requires, and argparse will figure out how to parse those out of sys.argv. The argparse module also automatically generates help and usage messages and issues errors when users give the program invalid arguments. 15.4.1. Example The following code is a Python program that takes a list of integers and produces either the sum or the max: Manage Python Script Options. Some time ago I was working on a simple Python script.

What the script did is not very important for this article. What is important, is the way it parsed arguments, and the way I managed to improve it. All below examples look similar to that script, however I cut most of the code, and changed the sensitive information, which I cannot publish. The main ideas for the options management are: Issue with singleton python call two times __init__ Structuring Your Project. By “structure” we mean the decisions you make concerning how your project best meets its objective. We need to consider how to best leverage Python’s features to create clean, effective code. In practical terms, “structure” means making clean code whose logic and dependencies are clear as well as how the files and folders are organized in the filesystem.

Pip - Python Packages Offline Installation. Installing Python Modules. This document describes the Python Distribution Utilities (“Distutils”) from the end-user’s point-of-view, describing how to extend the capabilities of a standard Python installation by building and installing third-party Python modules and extensions. Introduction Although Python’s extensive standard library covers many programming needs, there often comes a time when you need to add some new functionality to your Python installation in the form of third-party modules. This might be necessary to support your own programming, or to support an application that you want to use and that happens to be written in Python.

In the past, there has been little support for adding third-party modules to an existing Python installation. 2. Writing the Setup Script. The setup script is the centre of all activity in building, distributing, and installing modules using the Distutils. The main purpose of the setup script is to describe your module distribution to the Distutils, so that the various commands that operate on your modules do the right thing. As we saw in section A Simple Example above, the setup script consists mainly of a call to setup(), and most information supplied to the Distutils by the module developer is supplied as keyword arguments to setup().

Here’s a slightly more involved example, which we’ll follow for the next couple of sections: the Distutils’ own setup script. 6. Modules — Python 2.7.11 documentation. Python - Doing absolute imports from a subfolder. Python - Doing absolute imports from a subfolder. Configuring Module Dependencies and Libraries. On this page: See also, Dependencies, Library and Configuring Project and Global Libraries. Creating a module library and adding it to module dependencies. MySQL-python 1.2.5. Simple Python application. In this section: Before you start.