background preloader

Requests: HTTP for Humans — Requests 2.18.1 documentation

Requests: HTTP for Humans — Requests 2.18.1 documentation
Related:  Python

The Python Tutorial — Python 2.7.13 documentation Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented programming. Python’s elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms. The Python interpreter and the extensive standard library are freely available in source or binary form for all major platforms from the Python Web site, and may be freely distributed. The same site also contains distributions of and pointers to many free third party Python modules, programs and tools, and additional documentation. The Python interpreter is easily extended with new functions and data types implemented in C or C++ (or other languages callable from C). This tutorial introduces the reader informally to the basic concepts and features of the Python language and system.

mutagen - Python multimedia tagging library What is Mutagen? Mutagen is a Python module to handle audio metadata. It supports ASF, FLAC, M4A, Monkey's Audio, MP3, Musepack, Ogg Opus, Ogg FLAC, Ogg Speex, Ogg Theora, Ogg Vorbis, True Audio, WavPack and OptimFROG audio files. All versions of ID3v2 are supported, and all standard ID3v2.4 frames are parsed. There is a brief tutorial with several API examples. There is also an online documentation. Where do I get it? The download page will have the latest version. $ hg clone $ hg clone Why Mutagen? Quod Libet has more strenuous requirements in a tagging library than most programs that deal with tags. Mutagen has a simple API, that is roughly the same across all tag formats and versions and integrates into Python's builtin types and interfaces. Real World Use Mutagen can load nearly every MP3 we have thrown at it (when it hasn't, we make it do so). The following software projects are using Mutagen for tagging: Contact

Gunicorn Microcaching: Speed your app up 250x with no new code - Fenn's Thoughts - Vimperator I recently had the opportunity to help some friends out preparing a content site (wordpress) for a fairly hefty traffic hit. It was potentially going to be a big spike (national radio campaign, time sensitive content, etc) and they particularly didn't want it to go down at the critical time. I put together a fairly typical "fast" PHP architecture: nginx, PHP-FPM, APC, front-end app cluster, load balancer, replicated DB, along with all the mess that comes with it - machine images, replicated filesystem, etc, etc. After much mucking around, I had an awesome complicated, linearly scalable difficult to manage, app cluster that could scale to the stars very easily develop non-obvious bottlenecks. It turns out that you can throw all of this out and replace it with a 23 line nginx config. How? Concept Microcaching is like an insulation layer for your app - Let's say your wordpress install (or rails app) can handle 20 requests/sec fairly happily. Changing Data The Config Benchmarks 2364 reqs/sec.

Using the Requests Library in Python First things first, let’s introduce you to Requests. What is the Requests Resource? Requests is an Apache2 Licensed HTTP library, written in Python. It is designed to be used by humans to interact with the language. This means you don’t have to manually add query strings to URLs, or form-encode your POST data. What can Requests do? Requests will allow you to send HTTP/1.1 requests using Python. In programming, a library is a collection or pre-configured selection of routines, functions, and operations that a program can use. Libraries are important, because you load a module and take advantage of everything it offers without explicitly linking to every program that relies on them. Think of modules as a sort of code template. To reiterate, Requests is a Python library. How to Install Requests The good news is that there are a few ways to install the Requests library. You can make use of pip, easy_install, or tarball. If you’d rather work with source code, you can get that on GitHub, as well.

Top 15 Python Libraries for Data Science in 2017 – ActiveWizards: machine learning company – Medium As Python has gained a lot of traction in the recent years in Data Science industry, I wanted to outline some of its most useful libraries for data scientists and engineers, based on recent experience. And, since all of the libraries are open sourced, we have added commits, contributors count and other metrics from Github, which could be served as a proxy metrics for library popularity. Core Libraries. 1. NumPy (Commits: 15980, Contributors: 522) When starting to deal with the scientific task in Python, one inevitably comes for help to Python’s SciPy Stack, which is a collection of software specifically designed for scientific computing in Python (do not confuse with SciPy library, which is part of this stack, and the community around this stack). The most fundamental package, around which the scientific computation stack is built, is NumPy (stands for Numerical Python). 2. SciPy is a library of software for engineering and science. 3. There are two main data structures in the library: 5.

pyparsing - Examples Pyparsing comes with an examples directory, containing many sample parsing programs. Some of these have been contributed by pyparsing users - I am happy to include these with the pyparsing distribution, if you have developed a useful sample program. This directory contains a number of Python scripts that can get you started in learning to use pyparsing. Use this legend for some guidance on which examples to view: Parse "Hello, World!".greetingInKorean.py ~ submission by June Kim Unicode example to parse "Hello, World!" Simple example to demonstrate the use of ParseResults returned from parseString(). An exercise in replacing the builtin Python urlparse module, fixes a few bugs that the Python builtin version has. A sample program that reads a number in words (such as "fifteen hundred and sixty four"), and returns the actual number (1564). ~ suggested by JH Stovall A sample program that parses the EBNF used in the Python source code to define the Python grammar. ~ submission by Steven Siew

Pygreen 9 Awesome SSH Tricks Sorry for the lame title. I was thinking the other day, about how awesome SSH is, and how it's probably one of the most crucial pieces of technology that I use every single day. Here's a list of 10 things that I think are particularly awesome and perhaps a bit off the beaten path. Update: (2011-09-19) There are some user-submitted ssh-tricks on the wiki now! Please feel free to add your favorites. SSH Config I used SSH regularly for years before I learned about the config file, that you can create at ~/.ssh/config to tell how you want ssh to behave. Consider the following configuration example: Host example.com *.example.net User root Host dev.example.net dev.example.net User shared Port 220 Host test.example.com User root UserKnownHostsFile /dev/null StrictHostKeyChecking no Host t HostName test.example.org Host * Compression yes CompressionLevel 7 Cipher blowfish ServerAliveInterval 600 ControlMaster auto ControlPath /tmp/ssh-%r@%h:%p Control Master/Control Path SSH Keys SSH Agent

How to loop through a list of urls for web scraping with BeautifulSoup Introducing Pandas Objects Welcome back. Please sign in. Welcome back. {* #userInformationForm *} {* traditionalSignIn_emailAddress *} {* traditionalSignIn_password *} {* traditionalSignIn_signInButton *} {* /userInformationForm *} Please confirm the information below before signing in. {* #socialRegistrationForm *} {* socialRegistration_firstName *} {* socialRegistration_lastName *} {* socialRegistration_displayName *} {* socialRegistration_emailAddress *} {* providerName *} {* profileURL *} {* profilePreferredUsername *} {* profileIdentifier *} {* /socialRegistrationForm *} You're now signed in to O'Reilly.com. Please confirm the information below to create a new account. {* #registrationForm *} {* traditionalRegistration_firstName *} {* traditionalRegistration_lastName *} {* traditionalRegistration_displayName *} {* traditionalRegistration_emailAddress *} {* traditionalRegistration_password *} {* traditionalRegistration_passwordConfirm *} {* /registrationForm *} We'll send you a link to reset your password.

Flask-OAuth Flask-OAuth is an extension to Flask that allows you to interact with remote OAuth enabled applications. Currently it only implements the consumer interface so you cannot expose your own API with OAuth. Flak-OAuth depends on the python-oauth2 module. Features Support for OAuth 1.0aFriendly APIDirect integration with FlaskBasic support for remote method invocation of RESTful APIs Installation Install the extension with one of the following commands: $ pip install Flask-OAuth Alternatively, use easy_install: $ easy_install Flask-OAuth Defining Remote Applications To connect to a remote application create a OAuth object and register a remote application on it using the remote_app() method: from flask_oauth import OAuth oauth = OAuth()the_remote_app = oauth.remote_app('the remote app', ...) A remote application must define several URLs required by the OAuth machinery: request_token_urlaccess_token_urlauthorize_url Additionally the application should define an issued consumer_key and consumer_secret.

-= 10 Technical Papers Every Programmer Should Read (At Least Twice) =- 10 Technical Papers Every Programmer Should Read (At Least Twice) this is the second entry in a series on programmer enrichment Inspired by a fabulous post by Michael Feathers along a similar vein, I’ve composed this post as a sequel to the original. That is, while I agree almost wholly with Mr. Feather’s1 choices, I tend to think that his choices are design-oriented2 and/or philosophical. All papers are freely available online (i.e. not pay-walled)They are technical (at times highly so)They cover a wide-range of topicsThe form the basis of knowledge that every great programmer should know, and may already Because of these constraints I will have missed some great papers, but for the most part I think this list is solid. A Visionary Flood of Alcohol Fundamental Concepts in Programming Languages (link to paper) by Christopher Strachey Quite possibly the most influential set of lecture notes in the history of computer science. Why Functional Programming Matters (link to paper) by John Hughes

Related: