background preloader

Python

Facebook Twitter

Untitled. Getting Started - Google APIs Client Library for Python. Import BaseHTTPServerimport Cookieimport httplib2import StringIOimport urlparseimport sys from apiclient.discovery import buildfrom oauth2client.client import AccessTokenRefreshErrorfrom oauth2client.client import OAuth2WebServerFlowfrom oauth2client.file import Storage class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): """Child class of BaseHTTPRequestHandler that only handles GET request.

Getting Started - Google APIs Client Library for Python

""" # Create a flow object. This object holds the client_id, client_secret, and # scope. It assists with OAuth 2.0 steps to get user authorization and # credentials. Def do_GET(self): """Handler for GET request. """ print '\nNEW REQUEST, Path: %s' % (self.path) print 'Headers: %s' % self.headers # To use this server, you first visit # You can use any name you # like for the fake_user. Python for Scientific Computing. Pythoneering. S Python Class - Google's Python Class - Google Code. Welcome to Google's Python Class -- this is a free class for people with a little bit of programming experience who want to learn Python.

s Python Class - Google's Python Class - Google Code

The class includes written materials, lecture videos, and lots of code exercises to practice Python coding. These materials are used within Google to introduce Python to people who have just a little programming experience. The first exercises work on basic Python concepts like strings and lists, building up to the later exercises which are full programs dealing with text files, processes, and http connections. The class is geared for people who have a little bit of programming experience in some language, enough to know what a "variable" or "if statement" is. Beyond that, you do not need to be an expert programmer to use this material. This material was created by Nick Parlante working in the engEDU group at Google. Instant Python. This is a minimal crash-course in the programming language Python.

Instant Python

To learn more, take a look at the documentation at the Python web site, www.python.org; especially the tutorial. If you wonder why you should be interested, check out the comparison page where Python is compared to other languages. This introduction has been translated into several languages, among them Portuguese, Italian, Spanish, Russian, French, Lithuanian, Japanese, German and Greek, and is currently being translated into Norwegian, Polish, and Korean.

Since this document still might undergo changes, these translations may not always be up to date. Note: To get the examples working properly, write the programs in a text file and then run that with the interpreter; do not try to run them directly in the interactive interpreter - not all of them will work. BeginnersGuide/Programmers. Please Note This is a Wiki page.

BeginnersGuide/Programmers

Users with edit rights can edit it. You are therefore free to (in fact, encouraged to) add details of material that other Python users will find useful. It is not an advertising page and is here to serve the whole Python community. Users who continually edit pages to give their own materials (particularly commercial materials) prominence, or spam the listing with multiple entries which point to resources with only slightly altered material, may subsequently find their editing rights disabled. Python for Programmers The tutorials on this page are aimed at people who have previous experience with other programming languages (C, Perl, Lisp, Visual Basic, etc.).

Books, Websites, Tutorials (non-interactive) Tutorial - py2exe.org. Py2exe turns Python programs into packages that can be run on other Windows computers without needing to install Python on those computers.

Tutorial - py2exe.org

A simple IRC BOT written in Python - This article shows you how to make a simple IRC bot in python. First question: why the hell not eggdrop?

A simple IRC BOT written in Python - This article shows you how to make a simple IRC bot in python.

Answer: I don't know TCL, and I like to customize my scripts; plus it's a heavy program, and I hardly need 1% of the features it provides. I have been using python for a few months now and absoulutely love it. Creating bots in python is quite a simple job really. So lets start making it. Importing the libraries: import sys import socket import string import os #not necassary but later on I am going to use a few features from this With that done, now we need to give a configuration: HOST='mesa.az.us.undernet.org' #The server we want to connect to PORT=6667 #The connection port which is usually 6667 NICK='pybotv000' #The bot's nickname IDENT='pybot' REALNAME='s1ash' OWNER='ne0n-' #The bot owner's nick CHANNELINIT='#test198' #The default channel for the bot readbuffer='' #Here we store all the messages from server Warning:Keep the nickname quite unique because then you'll have to use a method to change the nick if it is already taken. while 1:

Simple Python IRC Bot. #!

Simple Python IRC Bot

/usr/bin/env python# This code was written for Python 3.1.1# version 0.101# Changelog:# version 0.100# Basic framework## version 0.101# Fixed an error if an admin used a command with an argument, that wasn't an admin-only commandimport socket, sys, threading, time# Hardcoding the root admin - it seems the best way for nowroot_admin = "maslen"# Defining a class to run the server. Python - IRC bot functionalities.