Skip to content
Advertisement

Asynchronous Requests with Python requests

I tried the sample provided within the documentation of the requests library for python. With async.map(rs), I get the response codes, but I want to get the content of each page requested. This, for example, does not work: Answer Note The below answer is not applicable to requests v0.13.0+. The asynchronous functionality was moved to grequests after this question was

custom dict that allows delete during iteration

UPDATED based on Lennart Regebro’s answer Suppose you iterate through a dictionary, and sometimes need to delete an element. The following is very efficient: The only overhead here is building the list of keys to remove; unless it grows large compared to the dictionary size, it’s not an issue. However, this approach requires some extra coding, so it’s not very

Ignoring library.zip in py2exe

I need to have an executable file (.exe) which takes some parameters from a file which can be configured by the user depending on his/her need. Since i have created scripts in python, i have used py2exe to create that executable. Though i could place a configurable file called settings.dat as data file and use it to customize, i feel

How to trace the path in a Breadth-First Search?

How do you trace the path of a Breadth-First Search, such that in the following example: If searching for key 11, return the shortest list connecting 1 to 11. Answer You should have look at http://en.wikipedia.org/wiki/Breadth-first_search first. Below is a quick implementation, in which I used a list of list to represent the queue of paths. This prints: [‘1’, ‘4’,

Issue with virtualenv – cannot activate

I created a virtualenv around my project, but when I try to activate it I cannot. It might just be syntax or folder location, but I am stumped right now. You can see below, I create the virtualenv and call it venv. Everything looks good, then I try to activate it by running source venv/bin/activate I’m thinking it might just

adding xml content to sphinx generated doc

So here is my problem. I’m trying to generate documentation for my project using sphinx and managed to get the basic working, like adding modules and images. So a basic index.rst would look like: ‘tvb’ here contains top level modules and links to sub-packages and so on. This seems to work fine and the html documentation is generated accordingly. However

Advertisement