Web Development int64 0 1 | Data Science and Machine Learning int64 0 1 | Question stringlengths 28 6.1k | is_accepted bool 2
classes | Q_Id int64 337 51.9M | Score float64 -1 1.2 | Other int64 0 1 | Database and SQL int64 0 1 | Users Score int64 -8 412 | Answer stringlengths 14 7k | Python Basics and Environment int64 0 1 | ViewCount int64 13 1.34M | System Administration and DevOps int64 0 1 | Q_Score int64 0 1.53k | CreationDate stringlengths 23 23 | Tags stringlengths 6 90 | Title stringlengths 15 149 | Networking and APIs int64 1 1 | Available Count int64 1 12 | AnswerCount int64 1 28 | A_Id int64 635 72.5M | GUI and Desktop Applications int64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 0 | I'm downloading files over HTTPS, I request the files through urllib2.Request and they come back as a socket._fileobject. I'd ideally like to stream this to file to avoid loading it into memory but I'm not sure how to do this.
My problem is if I call .read() on the object it only returns all the data up to the first NU... | true | 7,581,963 | 1.2 | 0 | 0 | 1 | I found out the problem was that I was running the code inside PyScripter and the in-built python interpreter terminates NUL bytes in the output. So there was no problem with my code, if I run it outside PyScripter everything works fine. Now running Wing IDE and never looking back :) | 0 | 406 | 0 | 2 | 2011-09-28T10:42:00.000 | python,nul | read() stops after NUL character | 1 | 1 | 1 | 7,791,175 | 0 |
1 | 0 | Lets say an operation could take 2 to 10 minutes on the server to perform, for example to update an index which is time consuming.
Would you perform the operation while holding the request? ie not sending a HTTP Response until the operation has finished? And if the client/browser drops the request, just continue with ... | false | 7,587,939 | 0.132549 | 0 | 0 | 2 | For requests that you know will take a long time (more than a few seconds) to process, you must assume at minimum that the connection may be forcibly severed by a firewall.
I would say you should implement a queue system on the backend. The request to perform the operation becomes a request to queue the operation. Wh... | 0 | 489 | 0 | 2 | 2011-09-28T18:42:00.000 | python,http,request | Should you hold a HTTP request while the server performs a time consuming operation? Or let the request go? | 1 | 2 | 3 | 7,588,103 | 0 |
1 | 0 | Lets say an operation could take 2 to 10 minutes on the server to perform, for example to update an index which is time consuming.
Would you perform the operation while holding the request? ie not sending a HTTP Response until the operation has finished? And if the client/browser drops the request, just continue with ... | true | 7,587,939 | 1.2 | 0 | 0 | 3 | You might also use a chunked response. First, push a chunk with some code that would display the “please wait” screen, flush the response and start the work. Then you can either push and flush chunks with periodical progress updates or just push one at the end with a “completed” information. Obviously you can employ Ja... | 0 | 489 | 0 | 2 | 2011-09-28T18:42:00.000 | python,http,request | Should you hold a HTTP request while the server performs a time consuming operation? Or let the request go? | 1 | 2 | 3 | 7,588,099 | 0 |
1 | 0 | I have got a working web application in Python that downloads a file into the web server upon a user's request. This works fine for small file downloads but when the user requests a larger file, the connection times out. So, I think I need to process the download in the background but I'm not sure what tool is most sui... | true | 7,595,809 | 1.2 | 0 | 0 | 2 | Timout duration is up to you, you could just make it longer.
Anyway there are plenty of flash or AJAX uploaders out there, nothing you can do only server side AFAIK | 0 | 751 | 0 | 3 | 2011-09-29T10:14:00.000 | python,web-applications,background | Downloading files in background with Python | 1 | 1 | 1 | 7,595,902 | 0 |
0 | 0 | I asked a similar question yesterday but I included some code that basically took my question on a different tangent than I had intended. So I shall try again.
I am rewriting a python script that crawls a website to find a few hundred text files, I have no interest in any content of the text file beyond the second lin... | false | 7,621,249 | 0.066568 | 0 | 0 | 1 | You could try something like urllib2.urlopen('url').read().splitlines()[1] but I guess that would download the entire file to memory | 0 | 124 | 0 | 0 | 2011-10-01T15:47:00.000 | python | opening files from a website | 1 | 1 | 3 | 7,621,359 | 0 |
0 | 0 | I have an HTTP server which host some large file and have python clients (GUI apps) which download it.
I want the clients to download the file only when needed, but have an up-to-date file on each run.
I thought each client will download the file on each run using the If-Modified-Since HTTP header with the file time of... | false | 7,623,600 | 0.066568 | 0 | 0 | 1 | You can add a header called ETag, (hash of your file, md5sum or sha256 etc ), to compare if two files are different instead of last-modified date | 0 | 1,447 | 0 | 3 | 2011-10-01T23:25:00.000 | python,http,httpclient,urllib2,if-modified-since | Sync local file with HTTP server location (in Python) | 1 | 2 | 3 | 7,623,988 | 0 |
0 | 0 | I have an HTTP server which host some large file and have python clients (GUI apps) which download it.
I want the clients to download the file only when needed, but have an up-to-date file on each run.
I thought each client will download the file on each run using the If-Modified-Since HTTP header with the file time of... | false | 7,623,600 | 0 | 0 | 0 | 0 | I'm assuming some things right now, BUT..
One solution would be to have a separate HTTP file on the server (check.php) which creates a hash/checksum of each files you're hosting. If the files differ from the local files, then the client will download the file. This means that if the content of the file on the server ch... | 0 | 1,447 | 0 | 3 | 2011-10-01T23:25:00.000 | python,http,httpclient,urllib2,if-modified-since | Sync local file with HTTP server location (in Python) | 1 | 2 | 3 | 7,623,922 | 0 |
0 | 0 | So I'm working on a Python IRC framework, and I'm using Python's socket module. Do I feel like using Twisted? No, not really.
Anyway, I have an infinite loop reading and processing data from socket.recv(xxxx), where xxxx is really irrelevant in this situation. I split the received data into messages using str.split(... | false | 7,642,309 | 0 | 0 | 0 | 0 | Stream-mode sockets (e.g, TCP) never guarantee that you'll receive messages in any sort of neatly framed format. If you receive partial lines of input -- which will inevitably happen sometimes -- you need to hold onto the partial line until the rest of the line shows up.
Using Twisted will save you a lot of time. Bette... | 1 | 195 | 0 | 1 | 2011-10-04T01:02:00.000 | python,sockets,irc | Issues with Python socket module | 1 | 1 | 2 | 7,642,402 | 0 |
0 | 0 | I'd like to do perform data mining on a large scale. For this, I need a fast crawler. All I need is something to download a web page, extract links and follow them recursively, but without visiting the same url twice. Basically, I want to avoid looping.
I already wrote a crawler in python, but it's too slow. I'm not ab... | false | 7,653,276 | 0.119427 | 0 | 0 | 3 | Around 2 years ago i have developed a crawler. And it can download almost 250urls per second. You could flow my steps.
Optimize your file pointer use. Try to use minimal file pointer.
Don't write your data every time. Try to dump your data after
storing around 5000 url or 10000 url.
For your robustness you don't need ... | 1 | 7,297 | 0 | 8 | 2011-10-04T19:51:00.000 | python,multithreading,web-crawler,web-mining | Fast internet crawler | 1 | 1 | 5 | 11,539,776 | 0 |
0 | 0 | In boto and S3 modules the S3 connection constructor takes the access key and the secret key. Is there a connection object that exists that also takes a session token? | true | 7,673,840 | 1.2 | 0 | 0 | 2 | This hadn't currently been implemented in boto but has been now and will be in version 2.1 or is available now if you check out the source from github.
You can use a session token by passing the token with the key word argument security_token to boto.connect_s3. I think the session token will be implemented elsewhere s... | 0 | 2,197 | 0 | 1 | 2011-10-06T11:49:00.000 | python,amazon-s3 | Is there a way to create a S3 connection with a sessions token? | 1 | 1 | 2 | 7,791,237 | 0 |
0 | 0 | I need to trigger my AntiVirus (McAfee) when accessing a test-virus URL (http://eicar.org/download/eicar.com) via python. If I use IE, Firefox or even wget for windows, the AntiVirus detects that a virus URL was accessed, which is the expected behavior. However, when using urllib or urllib2, the virus URL is successful... | true | 7,679,557 | 1.2 | 0 | 0 | 2 | Write the output to disk- the virus scanner will see it then. | 0 | 145 | 0 | 1 | 2011-10-06T19:37:00.000 | python,windows | Python and Opswat | 1 | 1 | 1 | 7,679,786 | 0 |
1 | 0 | Imagine that you need to write some Javascript that simply changes a set of checkboxes when a drop down list is changed.
Depending on which item is selected in the list, some of the checkboxes will become checked/unchecked.
In the back, you have Python code along with some SQLAlchemy.
The Javascript needs to identify t... | false | 7,689,695 | 1 | 0 | 0 | 6 | python has a json module, which is a perfect fit for this scenario.
using a good old AJAX, with json as the data format will allow you to exchange data between javascript and your python module.
(unless your python module is running on the client side, but then i don't see how you could execute it from the browser...) | 0 | 18,016 | 0 | 15 | 2011-10-07T15:49:00.000 | javascript,python,variables,sqlalchemy | Passing variables between Python and Javascript | 1 | 1 | 3 | 7,689,717 | 0 |
1 | 0 | Hello I am having problems with audio being sent over the network. On my local system with no distance there is no problems but whenever I test on a remote system there is audio but its not the voice input i want its choppy/laggy etc. I believe its in how I am handling the sending of the audio but I have tried now for ... | false | 7,720,932 | 0 | 1 | 0 | 0 | Did you run ping or ttcp to test network performance between the 2 hosts?
If you have latency spikes or if some packets are dropped your approach to sending voice stream will suffer badly. TCP will wait for missing packet, report it being lost, wait for retransmit, etc.
You should be using UDP over lossy links and audi... | 0 | 2,438 | 0 | 2 | 2011-10-11T02:55:00.000 | python,tcp,speex,pyaudio | Python Audio over Network Problems | 1 | 1 | 1 | 13,102,430 | 0 |
1 | 0 | I want to crawl and save some webpages as HTML. Say, crawl into hundreds popular websites and simply save their frontpages and the "About" pages.
I've looked into many questions, but didn't find an answer to this from either web crawling or web scraping questions.
What library or tool should I use to build the solution... | false | 7,722,876 | 0.066568 | 0 | 0 | 2 | If you are going to builld a crawler you need to (Java specific):
Learn how to use the java.net.URL and java.net.URLConnection classes or use the HttpClient library
Understand http request/response headers
Understand redirects (both HTTP, HTML and Javascript)
Understand content encodings (charsets)
Use a good librar... | 0 | 4,419 | 0 | 2 | 2011-10-11T07:48:00.000 | java,python,web-crawler,web-scraping,web-mining | Web mining or scraping or crawling? What tool/library should I use? | 1 | 1 | 6 | 7,723,049 | 0 |
1 | 0 | Im using my GAE application on my phone. I face a problem in getting the disconnect notification to /_ah/channel/disconnected in channels api even if i manually close the socket by socket.close() function. the post occurs after a delay of say one minute. Does anyone know the way to speed things up? In my case socket.c... | true | 7,736,105 | 1.2 | 0 | 0 | 4 | The amount of time it takes the Channel API front-end servers to "realize" that a channel is disconnected is contingent on browser implementation.
On well-behaved browsers, we catch the beforeunload event and post a message to our front-end that says, "this client is going away." On other browsers, we may not get the e... | 0 | 1,617 | 1 | 4 | 2011-10-12T06:29:00.000 | javascript,python,google-app-engine,channel-api | Channel disconnect notification in channel api in google app engine | 1 | 1 | 1 | 7,741,709 | 0 |
0 | 0 | We have devices that run a proprietary FTP client on them. They retrieve media files (AVI videos and Images) as well as XML files from our web service utilizing a python based FTP server. The problem I'm having is that the FTP client wants to download the media files in ASCII mode instead of binary mode. I'd like to co... | true | 7,742,965 | 1.2 | 1 | 0 | 2 | You can override the default behaviour or you ftp server by using a custom FTPHandler and overriding the FTPHandler.ftp_TYPE(filetype) method and this way force your server to serve file in binary mode self._current_type = "i". | 0 | 1,814 | 0 | 3 | 2011-10-12T15:58:00.000 | python,ftp | Can you force an FTP client to use binary from the server side | 1 | 1 | 1 | 7,743,098 | 0 |
1 | 0 | I want to have a "control panel" on a website, and when a button is pressed, I want it to run a command on the server (my computer). The panel is to run different python scripts I wrote (one script for each button), and I want to run the panel on my Mac, my iPod touch, and my wii. The best way I see for this is a web... | false | 7,747,852 | 0 | 0 | 0 | 0 | On the client side (the browser), you can do it with the simplest approach. Just an html form. javascript would make it nicer for validation and to do ajax calls so the page doesnt have to refresh. But your main focus is handling it on the server. You could receive the form request in the language of your choice. If yo... | 0 | 198 | 0 | 0 | 2011-10-12T23:43:00.000 | javascript,python,macos,unix,controls | Running command with browser | 1 | 2 | 3 | 7,747,962 | 0 |
1 | 0 | I want to have a "control panel" on a website, and when a button is pressed, I want it to run a command on the server (my computer). The panel is to run different python scripts I wrote (one script for each button), and I want to run the panel on my Mac, my iPod touch, and my wii. The best way I see for this is a web... | true | 7,747,852 | 1.2 | 0 | 0 | 0 | Here are three options:
Have each button submit a form with the name of the script in a hidden field. The server will receive the form parameters and can then branch off to run the appropriate script.
Have each button hooked to it's own unique URL and use javascript on the button click to just set window.location to ... | 0 | 198 | 0 | 0 | 2011-10-12T23:43:00.000 | javascript,python,macos,unix,controls | Running command with browser | 1 | 2 | 3 | 7,747,896 | 0 |
0 | 0 | I'm using Python to transfer (via scp) and database a large number of files. One of the servers I transfer files to has odd ssh config rules to stop too many ssh requests from a single location. The upshot of this is that my python script, currently looping through files and copying via os.system, hangs after a few f... | false | 7,757,059 | 0 | 1 | 0 | 0 | This is not really python specific, but it probably depends on what libraries you can use.
What you need is a way to send files through a single connection.
(This is probably better suited to superuser or severfault.com though.)
Create tarfile locally, upload it and unpack at target?
Maybe you could even run 'tar x... | 0 | 696 | 1 | 1 | 2011-10-13T16:07:00.000 | python,sockets,ssh,scp | open (and maintain) remote connection with python | 1 | 1 | 3 | 7,757,147 | 0 |
0 | 0 | I'm trying to run some automated functional tests using python and Twill. The tests verify that my application's OAuth login and connection endpoints work properly.
Luckily Twitter doesn't mind that Twill/Mechanize is accessing twitter.com. However, Facebook does not like the fact that I'm using Twill to access facebo... | false | 7,772,387 | 0.099668 | 1 | 0 | 1 | Try to send user agent header w/ mechanize. | 0 | 946 | 0 | 1 | 2011-10-14T19:06:00.000 | python,facebook,browser,twill | How to configure the python Twill/Mechanize library to acces Facebook | 1 | 1 | 2 | 7,773,528 | 0 |
0 | 0 | How do I write the function for Selenium to wait for a table with just a class identifier in Python? I'm having a devil of a time learning to use Selenium's Python webdriver functions. | false | 7,781,792 | 1 | 0 | 0 | 7 | I have made good experiences using:
time.sleep(seconds)
webdriver.Firefox.implicitly_wait(seconds)
The first one is pretty obvious - just wait a few seconds for some stuff.
For all my Selenium Scripts the sleep() with a few seconds (range from 1 to 3) works when I run them on my laptop, but on my Server the time to w... | 0 | 100,199 | 0 | 48 | 2011-10-16T01:33:00.000 | python,selenium,selenium-webdriver,automation,automated-tests | Selenium waitForElement | 1 | 2 | 14 | 7,784,387 | 0 |
0 | 0 | How do I write the function for Selenium to wait for a table with just a class identifier in Python? I'm having a devil of a time learning to use Selenium's Python webdriver functions. | false | 7,781,792 | 0 | 0 | 0 | 0 | If I don't know something about selenium command, I use selenium web idea RC with firefox. You can choose and add command in the combobox and when finish your test case after you can export the test code different language. like java, ruby, phyton, C#, etc.. | 0 | 100,199 | 0 | 48 | 2011-10-16T01:33:00.000 | python,selenium,selenium-webdriver,automation,automated-tests | Selenium waitForElement | 1 | 2 | 14 | 42,267,544 | 0 |
0 | 0 | I want to write an (GUI) application that listens both to keyboard events (client side generated events) and to a network port (server side generated events). I could use some high level advice on how to do this. Some additional info:
- I am using the wxPython module for the GUI
- I could set the socket in non-blocking... | false | 7,784,969 | 0 | 0 | 0 | 0 | I am not a wx expert. Could you use wx's native event driven mechanisms? The keypress would certainly have an event. Wx has a socket class wxSocketClient() that could translate the low level socket events (data ready, closed, etc) into a wx event. | 0 | 803 | 0 | 1 | 2011-10-16T14:40:00.000 | python,wxpython | Listening to network event and keyboard input at the same time in Python | 1 | 1 | 3 | 7,785,429 | 0 |
0 | 0 | I'm using zmq with python with an scheme REQ-REP in order to transfer data. I'm using right now the method send_json to send the data. But for some weird reason, with some examples it works, with other would not.
When the error occurs, the following error message and exception is shown:
File "socket.pyx", line 723, i... | false | 7,789,200 | 0.197375 | 0 | 0 | 1 | REQ-REP sockets have a strict send/receive cycle(or vice versa)
Mostly, this happens when you try to send a request before receiving a response or something similar. | 1 | 683 | 0 | 1 | 2011-10-17T03:52:00.000 | python,sockets,zeromq | Weird error sending integer list with send_json using sockets with zmq with python | 1 | 1 | 1 | 10,416,815 | 0 |
0 | 0 | I can't import WebOb 1.1 with the Python 2.7 runtime, as WebOb imports io, io imports _io, which is blocked by the SDK. Is there a way to whitelist _io? It is obviously not supposed to be blacklisted. | true | 7,801,387 | 1.2 | 1 | 0 | 1 | From context, it sounds like you're trying to run your app on the dev_appserver. The dev_appserver does not yet support the Python 2.7 runtime; for now you'll have to do your development and testing on appspot. | 0 | 201 | 0 | 1 | 2011-10-18T01:06:00.000 | python,google-app-engine,webob | GAE Python 2.7, no _io module? | 1 | 1 | 1 | 7,815,687 | 0 |
0 | 0 | I always had the idea that doing a HEAD request instead of a GET request was faster (no matter the size of the resource) and therefore had it advantages in certain solutions.
However, while making a HEAD request in Python (to a 5+ MB dynamic generated resource) I realized that it took the same time as making a GET requ... | true | 7,826,349 | 1.2 | 0 | 0 | 7 | The server is taking the bulk of the time, not your requester or the network. If it's a dynamic resource, it's likely that the server doesn't know all the header information - in particular, Content-Length - until it's built it. So it has to build the whole thing whether you're doing HEAD or GET. | 0 | 2,998 | 0 | 4 | 2011-10-19T18:39:00.000 | python,http,urllib2,head,pycurl | HEAD request vs. GET request | 1 | 3 | 3 | 7,826,403 | 0 |
0 | 0 | I always had the idea that doing a HEAD request instead of a GET request was faster (no matter the size of the resource) and therefore had it advantages in certain solutions.
However, while making a HEAD request in Python (to a 5+ MB dynamic generated resource) I realized that it took the same time as making a GET requ... | false | 7,826,349 | 0.066568 | 0 | 0 | 1 | The response time is dominated by the server, not by your request. The HEAD request returns less data (just the headers) so conceptually it should be faster, but in practice, many static resources are cached so there is almost no measureable difference (just the time for the additional packets to come down the wire). | 0 | 2,998 | 0 | 4 | 2011-10-19T18:39:00.000 | python,http,urllib2,head,pycurl | HEAD request vs. GET request | 1 | 3 | 3 | 7,826,409 | 0 |
0 | 0 | I always had the idea that doing a HEAD request instead of a GET request was faster (no matter the size of the resource) and therefore had it advantages in certain solutions.
However, while making a HEAD request in Python (to a 5+ MB dynamic generated resource) I realized that it took the same time as making a GET requ... | false | 7,826,349 | 0.066568 | 0 | 0 | 1 | Chances are, the bulk of that request time is actually whatever process generates the 5+MB response on the server rather than the time to transfer it to you.
In many cases, a web application will still execute the full script when responding to a HEAD request--it just won't send the full body back to the requester.
If ... | 0 | 2,998 | 0 | 4 | 2011-10-19T18:39:00.000 | python,http,urllib2,head,pycurl | HEAD request vs. GET request | 1 | 3 | 3 | 7,826,411 | 0 |
1 | 0 | Currently, there's a game that has different groups, and you can play for a prize 'gold' every hour. Sometimes there is gold, sometimes there isn't. It is posted on facebook every hour ''gold in group2" or "gold in group6'', and other times there isn't a post due to no gold being a prize for that hour. I want to write ... | false | 7,829,768 | 0.099668 | 0 | 0 | 1 | I have something similiar to what you have, but you left out what my main question revolves around. I looked at htmlparser and bs, but I am unsure how to do something like if($posttext == gold) echo "gold in so and so".. seems like bs deals a lot with tags..i suppose since facebook posts can use a variety of tags, how ... | 0 | 105 | 0 | 0 | 2011-10-20T00:21:00.000 | python,screen-scraping | fetch text from a web site and displaying it back | 1 | 1 | 2 | 7,853,614 | 0 |
0 | 0 | We occasionally have to debug glitchy Cisco routers that don't handle the TCP Selective Acknowledgment (SACK) options correctly. This causes our TCP sessions to die when routed through an IPTABLES port redirection rule.
To help with the diagnosis, I've been constructing a python-based utility to construct a sequence of... | true | 7,851,817 | 1.2 | 0 | 0 | 1 | Are you receiving and processing the packet and only need to suppress the ICMP port-unreachable? If so, maybe just add an entry to the iptables OUTPUT chain to drop it? | 0 | 197 | 1 | 2 | 2011-10-21T15:37:00.000 | python,linux,networking | Subsuming the Linux packet processing stack | 1 | 1 | 1 | 7,851,867 | 0 |
1 | 0 | I've heard that the Google Nexus S has RFID capabilities. I'd like to start learning about RFID and programmatically doing things. Where should I start? Good tutorials or code examples are what I'm after. (or hardware if it's not Android I suppose).
Doesn't have to be Android, could be python or java libraries as well.... | true | 7,857,940 | 1.2 | 0 | 0 | 1 | Buy a Nexus-S, buy some tags.
Then take a look at the code of the 'Tags' application that comes with android. Play with it, modify it. Write some tags with your own application.
Learn what Ndef is and how you craft your own messages/records. Learn how to use the transceive function to do direct communication to the ta... | 0 | 1,251 | 0 | 1 | 2011-10-22T07:00:00.000 | java,android,python,rfid | RFID + Android --> where do I start? | 1 | 1 | 1 | 7,858,130 | 0 |
1 | 0 | I have been using the XML package successfully for extracting HTML tables but want to extend to PDF's. From previous questions it does not appear that there is a simple R solution but wondered if there had been any recent developments
Failing that, is there some way in Python (in which I am a complete Novice) to obtai... | true | 7,918,718 | 1.2 | 0 | 0 | 11 | Extracting text from PDFs is hard, and nearly always requires lots of care.
I'd start with the command line tools such as pdftotext and see what they spit out. The problem is that PDFs can store the text in any order, can use awkward font encodings, and can do things like use ligature characters (the joined up 'ff' and... | 0 | 4,014 | 0 | 10 | 2011-10-27T15:54:00.000 | python,r,pdf,screen-scraping | PDF scraping using R | 1 | 1 | 4 | 7,918,885 | 0 |
0 | 0 | I'm using pycurl to crawl data from the Twitter Streaming API. However, after several hours, the connection just hangs there.
Is there anyway to detect this and exit the program? I know pycurl has TIMEOUT and CONNECTTIMEOUT, but these two params do not apply. | false | 7,924,499 | 0 | 0 | 0 | 0 | Do you get an exception or something and could you please add some code? :)
Maybe you should think about using another module like httplib (if you want to
use SSL/TLS you could create a new socket and overwrite the connect function of httplib with
your secure wrapped socket :) ) | 0 | 478 | 0 | 0 | 2011-10-28T02:24:00.000 | python,api,twitter,streaming,pycurl | Python pycurl with Twitter Streaming API | 1 | 1 | 1 | 7,928,557 | 0 |
0 | 0 | I need some help in implementing Multicast Streaming server over IPv6 preferably in Python. I am able to do so with Datagram servers but since I need to send large amounts of data (images and videos) over the connection, I get an error stating , data too large to send.
Can any one tell me how do I implement a Streamin... | false | 7,937,928 | 0.53705 | 0 | 0 | 3 | You DO want to use datagrams, as with multicast there are multiple receivers and a stream socket will not work.
You need to send your data in small chunks (datagrams) and state in each which part of the stream it is so receivers can detect lost (and reordered) datagrams.
Instead of inventing a new mechanism for identif... | 0 | 570 | 0 | 0 | 2011-10-29T09:04:00.000 | python,sockets,streaming,ipv6,multicast | How do I create a multicast stream socket over IPv6 in Python? | 1 | 1 | 1 | 7,939,658 | 0 |
1 | 0 | I am looking for a library in Python OR Java that can use webkit or similar rendering engine on the server side (without GUI) and return the DOM object for further processing like selecting the elements etc. | false | 7,939,069 | 0 | 0 | 0 | 0 | If you want to process (execute) the javascript on headless server to generate the HTML snapshot, try using a tool like Selenium.
Selenium will allow you to fully render the HTML webpage on server side and then you can use the generated HTML to make a snapshot. | 0 | 412 | 0 | 1 | 2011-10-29T13:02:00.000 | java,python,webkit,rendering,server-side | Python or Java module to render HTML page on server side and obtain DOM object | 1 | 1 | 1 | 51,939,389 | 0 |
0 | 0 | What is the Python 3 equivalent of python -m SimpleHTTPServer? | false | 7,943,751 | 1 | 1 | 0 | 7 | Just wanted to add what worked for me:
python3 -m http.server 8000 (you can use any port number here except the ones which are currently in use) | 0 | 725,970 | 0 | 1,528 | 2011-10-30T07:22:00.000 | python,python-3.x,httpserver,simplehttpserver | What is the Python 3 equivalent of "python -m SimpleHTTPServer" | 1 | 1 | 7 | 71,111,456 | 0 |
0 | 0 | I'm trying to use feedparser to retrieve some specific information from feeds, but also retrieve the raw XML of each entry (ie. elements for RSS and for Atom), and I can't see how to do that. Obviously I could parse the XML by hand, but that's not very elegant, would require separate support for RSS and Atom, and I i... | true | 7,945,669 | 1.2 | 0 | 0 | 2 | I'm the current developer of feedparser. Currently, one of the ways you can get that information is to monkeypatch feedparser._FeedParserMixin (or edit a local copy of feedparser.py). The methods you'll want to modify are:
feedparser._FeedParserMixin.unknown_starttag
feedparser._FeedParserMixin.unknown_endtag
At the ... | 0 | 1,115 | 0 | 2 | 2011-10-30T15:06:00.000 | python,xml,rss,atom-feed,feedparser | Retrieving raw XML for items with feedparser | 1 | 1 | 1 | 8,021,162 | 0 |
0 | 0 | I'm parsing some XML using Python's Expat (by calling parser = xml.parsers.expat.ParserCreate() and then setting the relevant callbacks to my methods).
It seems that when Expat calls read(nbytes) to return new data, nbytes is always 2,048. I have quite a lot of XML to process, and suspect that these small read()s are m... | true | 7,953,708 | 1.2 | 0 | 0 | 2 | You're talking about the xmlparse.ParseFile method, right?
Unfortunately, no, that value is hardcoded as BUF_SIZE = 2048 in pyexpat.c. | 0 | 192 | 0 | 0 | 2011-10-31T12:28:00.000 | python,xml,performance,expat-parser | Controlling number of bytes read() at a time with Expat | 1 | 1 | 1 | 7,960,421 | 0 |
0 | 0 | I'm writing a Python library to access Ubuntu One's REST API. (Yes, I know one already exists; this is a scratch-my-itch-and-learn-while-doing-it project.)
The library will be a relatively thin wrapper around the REST calls. I would like to be able to unit-test my library, without hitting U1 at all. What's the best pra... | true | 7,955,695 | 1.2 | 1 | 0 | 1 | Your cutting point is the HTTP requests.
Write a mock library which intercepts the sending of the HTTP requests. Instead of sending them, convert them into a String and analyze them to test sending code.
For receiving code, mock the response handler. Save a good response from the REST server in a String and create the ... | 0 | 604 | 0 | 1 | 2011-10-31T15:18:00.000 | python,unit-testing,mocking | How to test python library wrapping an external REST service (without hitting the service) | 1 | 1 | 1 | 7,956,472 | 0 |
0 | 0 | I am trying to calculate shortest path between 2 points using Dijkstra and A Star algorithms (in a directed NetworkX graph).
At the moment it works fine and I can see the calculated path but I would like to find a way of restricting certain paths.
For example if we have following nodes:
nodes = [1,2,3,4]
With these ed... | false | 7,983,724 | 0.291313 | 0 | 0 | 3 | You could set your node data {color=['blue']} for node 1, node 2 has {color=['red','blue']} and node3 has {color=['red']}. Then use an networkx.algorithms. astar_path() approach setting the
heuristic is set to a function which returns a might_as_well_be_infinity when it encountered an node without the same color you... | 0 | 2,143 | 0 | 11 | 2011-11-02T16:20:00.000 | python,routing,path-finding,networkx | How to restrict certain paths in NetworkX graphs? | 1 | 1 | 2 | 33,684,974 | 0 |
1 | 0 | I need to make an application which streams live multimedia. At present my application is taking image frames from a webcam (using OpenCV) and sending it to the client. It is also sending audio using pymedia module. The problem is that both the image and audio packets that arrive at the client are out of sync.
So I hav... | true | 7,993,624 | 1.2 | 0 | 0 | 2 | You can use gstreamer's python module. I mean gst-python mentioned above. Use rtmp protocol to synchronize client/server videos. Last time I use gst-python, there was no support for rtmp. At the time, my solution was to limit buffer size. When buffer gets full oldest frames will be dropped. | 1 | 18,589 | 0 | 10 | 2011-11-03T10:51:00.000 | python,video,streaming,live,ipv6 | Streaming audio and video with Python | 1 | 1 | 3 | 7,994,014 | 0 |
0 | 0 | So i been readying for a awhile now. And it seems like asynchronous socket handling would be a better approach to dealing with what I'm trying to do.
Right now I'm working on a gaming server. At the moment socket server will do ok with about 3 clients or so. Sending data at the same exact time.
But my problem is, af... | true | 7,995,290 | 1.2 | 0 | 0 | 1 | Asynchronous sockets are more effective then synchronous. But if the game is lagging for 4+ clients, then your server/client system is badly written and it is not the matter of sockets imho. | 0 | 198 | 0 | 0 | 2011-11-03T13:00:00.000 | python,sockets,asynchronous,udp | Is asynchronous socket handling the way i need to go? In Python | 1 | 1 | 1 | 7,995,699 | 0 |
1 | 0 | What is an accepted way to get authentication credentials (login and password) when using webapp?
I'm pretty sure that they get submitted and/or interpreted differently than the rest of the information coming through the request and I'm afraid I can't remember where exactly I'm supposed to get them from.
FYI: The reque... | true | 8,039,374 | 1.2 | 0 | 0 | 1 | Are you using the built in authentication, or trying to roll your own? If the former, you can't access a user's credentials - just get the information you need from the User object. If the latter, you can handle the credentials any way you wish - you're rolling your own, and App Engine has no magic way to detect that w... | 0 | 198 | 0 | 2 | 2011-11-07T16:24:00.000 | python,google-app-engine,web-applications,authentication,credentials | Getting login credentials when using webapp | 1 | 2 | 2 | 8,060,118 | 0 |
1 | 0 | What is an accepted way to get authentication credentials (login and password) when using webapp?
I'm pretty sure that they get submitted and/or interpreted differently than the rest of the information coming through the request and I'm afraid I can't remember where exactly I'm supposed to get them from.
FYI: The reque... | false | 8,039,374 | 0.197375 | 0 | 0 | 2 | If you've got HTTPS enabled, sending them along with the request (usually a POST) is acceptable, and the "standard" method of logging in.
If you want to get clever, you could hash the password using SHA1 on the client end so that even an sslstrip won't reveal the password in plaintext (though it won't prevent replay at... | 0 | 198 | 0 | 2 | 2011-11-07T16:24:00.000 | python,google-app-engine,web-applications,authentication,credentials | Getting login credentials when using webapp | 1 | 2 | 2 | 8,039,432 | 0 |
1 | 0 | I parse a website with python. They use a lot of redirects and they do them by calling javascript functions.
So when I just use urllib to parse the site, it doesn't help me, because I can't find the destination url in the returned html code.
Is there a way to access the DOM and call the correct javascript function from... | false | 8,053,295 | -0.099668 | 0 | 0 | -1 | It doesnt sound like fun to me, but every javascript function is a is also an object, so you can just read the function rather than call it and perhaps the URL is in it. Otherwise, that function may call another which you would then have to recurse into... Again, doesnt sound like fun, but might be doable. | 0 | 5,021 | 0 | 3 | 2011-11-08T15:58:00.000 | python,urllib2 | Getting the final destination of a javascript redirect on a website | 1 | 1 | 2 | 8,053,358 | 0 |
0 | 0 | Is it possible to set default headers for boto requests? Basically I want to include a couple of headers in every API call I make to S3. | true | 8,068,422 | 1.2 | 0 | 0 | 1 | Right now, extra headers have to be specified on each request. The various methods of the bucket and key class all take an optional headers parameter and the contents of that dict gets merged into the request headers.
Being able to specify extra headers at the bucket level and then have those merged into all requests ... | 0 | 348 | 0 | 2 | 2011-11-09T16:47:00.000 | python,amazon-s3,amazon-web-services,boto | Add "default" headers to all boto requests? | 1 | 1 | 1 | 8,068,778 | 0 |
0 | 0 | Does anyone know of a web proxy written in Python that will support SSL connections and will also support PKCS#11 tokens? I am in need of a proxy that will send SSL web requests using a PKCS#11 smartcard.
I have been looking for projects that are using something like Twisted but have not seen any. | false | 8,073,753 | 0 | 0 | 0 | 0 | If Twisted has a proxy, then you can use it with M2Crypto+engine_pkcs11. I had the code, I can see if it is still existing somewhere. | 0 | 459 | 0 | 1 | 2011-11-10T00:50:00.000 | python,proxy,smartcard,pkcs#11 | Python Web Proxy that Supports PKCS#11 | 1 | 1 | 1 | 8,079,122 | 0 |
0 | 0 | When I send credentials using the login method of the python SMTP library, do they go off the wire encrypted or as plaintext? | true | 8,074,227 | 1.2 | 1 | 0 | 3 | They will only be encrypted if you use SMTP with TLS or SSL. | 0 | 232 | 0 | 1 | 2011-11-10T02:12:00.000 | python,security,smtp,credentials | sending an email using python SMTP library credentials security | 1 | 1 | 1 | 8,074,236 | 0 |
0 | 0 | I wanted to know how to maximize a browser window using the Python bindings for Selenium 2-WebDriver. | false | 8,075,297 | 1 | 0 | 0 | 12 | You can use browser.maximize_window() for that | 0 | 9,312 | 0 | 2 | 2011-11-10T05:17:00.000 | python,webdriver,selenium-webdriver | How to maximize a browser window using the Python bindings for Selenium 2-WebDriver? | 1 | 1 | 3 | 18,481,265 | 0 |
0 | 0 | I write a python telnet client to communicate with a server through telnet. However, many people tell me that it's no secure. How can I convert it to ssh? Should I need to totally rewrite my program? | false | 8,088,742 | 0.066568 | 1 | 0 | 1 | While Telnet is insecure, it's essentially just a serial console over a network, which makes it easy to code for. SSH is much, much more complex. There's encryption, authentication, negotiation, etc to do. And it's very easy to get wrong in spectacular fashion.
There's nothing wrong with Telnet per se, but if you can c... | 0 | 1,247 | 0 | 0 | 2011-11-11T01:44:00.000 | python,security,ssh,telnet | python: convert telnet application to ssh | 1 | 1 | 3 | 8,088,775 | 0 |
1 | 0 | I have a page with a lot of ads being loaded in piece by piece.
I need to position an element relative to overall page height, which is changing during load, because of ads being added.
Question: Is there a jquery event or similar to detect, when all elements are loaded? I'm currently "waiting" with setTimeout, but thi... | false | 8,093,297 | 0 | 1 | 0 | 0 | Ideally the answer would be $(function(){ }) or window.onload = function(){} that fires after all the DOM contents are loaded. But I guess, the ads on your page starts loading asynchronously after the DOM load.
So, assuming you know the number of 'ads' on your page (you said you are loading them piece by piece), my ad... | 0 | 6,659 | 0 | 3 | 2011-11-11T11:26:00.000 | jquery,events,python-idle | jquery - can I detect once all content is loaded? | 1 | 1 | 4 | 8,093,470 | 0 |
1 | 0 | I have a program that I wrote in python that collects data. I want to be able to store the data on the internet somewhere and allow for another user to access it from another computer somewhere else, anywhere in the world that has an internet connection. My original idea was to use an e-mail client, such as g-mail, to ... | false | 8,098,068 | 0.099668 | 0 | 0 | 2 | I would suggest taking a look at setting up a simple site in google app engine. It's free and you can use python to do the site. Than it would just be a matter of creating a simple restful service that you could send a POST to with your pickled data and store it in a database. Than just create a simple web front end on... | 0 | 403 | 0 | 1 | 2011-11-11T18:02:00.000 | python,networking | Sending data through the web to a remote program using python | 1 | 4 | 4 | 8,098,102 | 0 |
1 | 0 | I have a program that I wrote in python that collects data. I want to be able to store the data on the internet somewhere and allow for another user to access it from another computer somewhere else, anywhere in the world that has an internet connection. My original idea was to use an e-mail client, such as g-mail, to ... | false | 8,098,068 | 0 | 0 | 0 | 0 | Adding this as an answer so that OP will be more likely to see it...
Make sure you consider security! If you just blindly accept pickled data, it can open you up to arbitrary code execution. | 0 | 403 | 0 | 1 | 2011-11-11T18:02:00.000 | python,networking | Sending data through the web to a remote program using python | 1 | 4 | 4 | 8,098,342 | 0 |
1 | 0 | I have a program that I wrote in python that collects data. I want to be able to store the data on the internet somewhere and allow for another user to access it from another computer somewhere else, anywhere in the world that has an internet connection. My original idea was to use an e-mail client, such as g-mail, to ... | false | 8,098,068 | 0 | 0 | 0 | 0 | I suggest you to use a good middle-ware like: Zero-C ICE, Pyro4, Twisted.
Pyro4 using pickle to serialize data. | 0 | 403 | 0 | 1 | 2011-11-11T18:02:00.000 | python,networking | Sending data through the web to a remote program using python | 1 | 4 | 4 | 8,099,975 | 0 |
1 | 0 | I have a program that I wrote in python that collects data. I want to be able to store the data on the internet somewhere and allow for another user to access it from another computer somewhere else, anywhere in the world that has an internet connection. My original idea was to use an e-mail client, such as g-mail, to ... | false | 8,098,068 | 0.049958 | 0 | 0 | 1 | Another option in addition to what Casey already provided:
Set up a remote MySQL database somewhere that has user access levels allowing remote connections. Your Python program could then simply access the database and INSERT the data you're trying to store centrally (e.g. through MySQLDb package or pyodbc package). ... | 0 | 403 | 0 | 1 | 2011-11-11T18:02:00.000 | python,networking | Sending data through the web to a remote program using python | 1 | 4 | 4 | 8,098,220 | 0 |
1 | 0 | I'm scraping pdf files from a site using Scrapy, a Python web-scraping framework.
The site requires to follow the same session in order to allow you to download the pdf.
It works great with Scrapy's because it's all automated but when I run the script after a couple of seconds it starts to give me fake pdf files like ... | false | 8,108,477 | 0 | 0 | 0 | 0 | I think the site tracks your session. If it's a PHP site, pass PHPSESSID cookie to the request which downloads the PDF file. | 0 | 1,740 | 0 | 0 | 2011-11-12T23:54:00.000 | python,session,cookies,scrapy | Downloading PDF files with Scrapy | 1 | 1 | 1 | 8,113,814 | 0 |
0 | 0 | Here is my setup: I have a Python webserver (written myself) that listens on port 80 and also have the Transmission-daemon (bittorrent client) that provides a webUI on port 9101. (running on Linux)
I can access both webservers locally without problems, but now would like to access them externally also. My issue is that... | false | 8,149,701 | 0.197375 | 0 | 0 | 2 | I found my answer: a reverse proxy. It will take care of the routing to the correct port based on the URL. I now just have to select the right one there are so many (NginX, pound, lighttd etc...)
Thanks anyway. | 0 | 388 | 1 | 1 | 2011-11-16T09:57:00.000 | python,linux,redirect,webserver,transmission | Redirecting traffic to other webserver | 1 | 1 | 2 | 8,166,815 | 0 |
1 | 0 | So I am writing link fetchers to find new links on particular sites for a given group of 'starting links'.
Currently I am using Python/Beautiful Soup to accomplish this with decent success.
I have an input file [for each site] that I build the 'starting links' list from.
I use urllib2 to load the webpages and then beau... | false | 8,156,736 | 0 | 0 | 0 | 0 | You should consider using hashes for comparing the previously collected list. Instead of storing a list of links as strings, store a list of MD5 or SHA1 hashes for those links. Comparing a hash to a list of hashes is much faster than comparing a string to a list of strings.
Or if you maintain and persist an actual ... | 0 | 130 | 0 | 0 | 2011-11-16T18:28:00.000 | python,beautifulsoup | Python Link Fetcher Performance Issue | 1 | 1 | 2 | 8,156,982 | 0 |
0 | 0 | I have a binary file which was created by a VBA file (I don't work with VBA or binary at all) but I need to get Python to read this binary file (which includes a list of inputs for a calculation) and then write these values into an xml file.
If I know the order of the inputs into the file that is created, is it possibl... | false | 8,168,482 | 0 | 0 | 0 | 0 | Python is probably not the best tool, I would recommend VBA as it is going to be best suited to reading that file. Then, create your xml file as output. | 0 | 1,333 | 0 | 0 | 2011-11-17T14:10:00.000 | python,xml,binary | Python file to read in binary and write in xml | 1 | 2 | 2 | 8,168,534 | 0 |
0 | 0 | I have a binary file which was created by a VBA file (I don't work with VBA or binary at all) but I need to get Python to read this binary file (which includes a list of inputs for a calculation) and then write these values into an xml file.
If I know the order of the inputs into the file that is created, is it possibl... | true | 8,168,482 | 1.2 | 0 | 0 | 0 | If you have the VBA code that made the file you should be able to copy the data structure in python and then deserialize it. | 0 | 1,333 | 0 | 0 | 2011-11-17T14:10:00.000 | python,xml,binary | Python file to read in binary and write in xml | 1 | 2 | 2 | 8,168,665 | 0 |
1 | 0 | I plan to run a webserver with some content generated through a Python script. I have a script that generates the data I would want to present at the moment that polls every 2 minutes with a fairly large request. How can I put this data onto a webpage without making voluminous numbers of requests? I can think of a few ... | true | 8,175,406 | 1.2 | 0 | 0 | 0 | I wouldn't write off the javascript polling idea.
Consider generating the file and pushing to a CDN. Make sure to let the CDN know you need a specific TTL that meets with the schedule you're generating with as their default TTL will probably be longer than 2 min. The CDN should be awesome at serving static content an... | 0 | 199 | 0 | 0 | 2011-11-17T22:39:00.000 | python,html,cgi | Dynamic Content with a Polling Interval | 1 | 1 | 1 | 8,175,486 | 0 |
0 | 0 | How can I wrap a boto.storage_uri() call in python so I can handle possible exceptions? | false | 8,176,002 | 1 | 0 | 0 | 30 | Your question about Boto is a good one, not not easy to answer. The Boto exception hierarchy is poorly designed, and ultimately the only way to determine what the exception you want to trap is requires looking at the boto source code.
For example if you look at (on Ubuntu) /usr/share/pyshared/boto/exception.py you will... | 1 | 14,487 | 0 | 8 | 2011-11-17T23:45:00.000 | python,boto | How can I handle a boto exception in python? | 1 | 1 | 3 | 12,064,611 | 0 |
0 | 0 | I am using sleekxmpp to connect to Google Talk. I am trying to track when contacts change their status using the changed_status event. The issue I am having is that as I log a status change, the function associated with the changed_status event seems to be called multiple times. Why might this be?
I am thinking it has ... | false | 8,177,403 | 0 | 0 | 0 | 0 | Check the resource associated with each change. If the resources are all different for the same user, it is because the user is logged on from several different clients, perhaps from multiple different machines. You will get presence updates from all of the user's clients if you're subscribed to them. | 0 | 471 | 0 | 2 | 2011-11-18T03:29:00.000 | python,xmpp,google-talk | sleekxmpp changed_status event, firing multiple times | 1 | 2 | 2 | 8,179,210 | 0 |
0 | 0 | I am using sleekxmpp to connect to Google Talk. I am trying to track when contacts change their status using the changed_status event. The issue I am having is that as I log a status change, the function associated with the changed_status event seems to be called multiple times. Why might this be?
I am thinking it has ... | true | 8,177,403 | 1.2 | 0 | 0 | 5 | The answer is that you exposed a bug in SleekXMPP that I need to fix :)
The changed_status event was firing for any presence stanza received, and not firing only when a resource's status or show value changed.
The bug fix is now in the develop branch and it will be in the soon-to-be RC3 release. | 0 | 471 | 0 | 2 | 2011-11-18T03:29:00.000 | python,xmpp,google-talk | sleekxmpp changed_status event, firing multiple times | 1 | 2 | 2 | 8,189,697 | 0 |
0 | 0 | I have a situation where XML data is being processed by two different mechanisms. In one place it is being processed using Python's xml.dom.minidom library. In the other, similar processing is being performed in .NET, via an XmlTextWriter.
In the output generated by the Python code, empty elements are written <ElementN... | false | 8,187,959 | 0.039979 | 0 | 0 | 1 | You'll find that the problem only occurs if you set the Indent property in the XmlWriterSettings to true. When Indent == false, there is no space inserted. But if you want indentation, you have to live with that space.
So perhaps the solution to your program is to turn off indentation in both tools?
This is unfortunate... | 0 | 505 | 0 | 4 | 2011-11-18T19:24:00.000 | .net,python,xml | Can I tell an XmlTextWriter to write instead of ? | 1 | 3 | 5 | 8,188,895 | 0 |
0 | 0 | I have a situation where XML data is being processed by two different mechanisms. In one place it is being processed using Python's xml.dom.minidom library. In the other, similar processing is being performed in .NET, via an XmlTextWriter.
In the output generated by the Python code, empty elements are written <ElementN... | false | 8,187,959 | 0 | 0 | 0 | 0 | If you're just looking for file integrity wouldn't a MD5 (or something similar) of the file be sufficient? | 0 | 505 | 0 | 4 | 2011-11-18T19:24:00.000 | .net,python,xml | Can I tell an XmlTextWriter to write instead of ? | 1 | 3 | 5 | 8,188,391 | 0 |
0 | 0 | I have a situation where XML data is being processed by two different mechanisms. In one place it is being processed using Python's xml.dom.minidom library. In the other, similar processing is being performed in .NET, via an XmlTextWriter.
In the output generated by the Python code, empty elements are written <ElementN... | false | 8,187,959 | 0 | 0 | 0 | 0 | I would just post-process the output to do search/replace instead of trying to mess with the library | 0 | 505 | 0 | 4 | 2011-11-18T19:24:00.000 | .net,python,xml | Can I tell an XmlTextWriter to write instead of ? | 1 | 3 | 5 | 8,188,032 | 0 |
0 | 0 | I tried a few python ports of flickr api and they didn't work on my Python here which is 3.2. I also have 2.7. Do you guys know any API that is compatible with the latest Flickr API as well latest update of Python? | true | 8,196,386 | 1.2 | 0 | 0 | 2 | I could run Python Flickr API (http://stuvel.eu/flickrapi) on Python2.7. It's not possible to run it on Python3 (according to its author). | 0 | 888 | 0 | 3 | 2011-11-19T18:50:00.000 | python,flickr | How to access Flickr API using Python? | 1 | 1 | 2 | 8,753,955 | 0 |
0 | 0 | I am using couchdb to store twitter data. I found that couchdb stops updating its data base though I keep getting the twitter data. I basically store the dictionary that contains twitter data by using the python couchdb save method, db.save(twitter_dic) where db is the database instance. I find that some times I get 3G... | true | 8,207,433 | 1.2 | 0 | 0 | 0 | I had to re install couchdb and I am marking this question accepted. | 0 | 140 | 0 | 0 | 2011-11-21T04:52:00.000 | python,database,couchdb | python couchdb data collection stops | 1 | 1 | 1 | 12,101,359 | 0 |
0 | 0 | I'm working on a online server, and I need all my list and dict saved. What would be the best and quickest way to approach this?
I tried importing the data, and it works to load the data. But how can I update the imported file? | true | 8,207,512 | 1.2 | 0 | 0 | 1 | I think you can use pickle/cPickle module to save and load the date, which are built-in module and easy to use.
I am not very sure the meaning of update import file, what about rewrite the content back to the file after updating in the program? | 1 | 98 | 0 | 1 | 2011-11-21T05:05:00.000 | python,storage,pickle | Saving to external PY file? | 1 | 1 | 1 | 8,207,550 | 0 |
0 | 0 | I'm using a class RequestHandler(SocketServer.BaseRequestHandler)to handle incoming connections to a server.
I am trying to get the name of the client which is stored as an attribute that sends data to this server, but right now I can only get it by asking for self.client_address which returns a tuple like Name of clie... | true | 8,219,865 | 1.2 | 0 | 0 | 1 | No. You would have to send that name over the communication channel. | 0 | 1,312 | 0 | 1 | 2011-11-21T23:11:00.000 | python,sockets,socketserver | How can I get a client's Name attribute with SocketServer in python? | 1 | 1 | 1 | 8,220,008 | 0 |
0 | 0 | I am doing a muticlient chat server program in twisted python. Is there any function in twisted python similar to 'select' in in socket programming? Can anybody give me the answer please?.. If yes, please tell me the implementation, please. | false | 8,280,373 | 0.197375 | 0 | 0 | 1 | No, there isn't.
Twisted calls select (or something like it) for you.
You don't ever need to call a function like select; just let the reactor run, and do its work for you. | 0 | 213 | 0 | 2 | 2011-11-26T17:53:00.000 | python,twisted | Is there any function in twisted python similar to 'select' in socket programming? | 1 | 1 | 1 | 8,282,424 | 0 |
0 | 0 | What is the most efficient way to get all of the external ip address of a machine with multiple nics, using python? I understand that an external server is neeeded (I have one available) but am un able to find a way to find a good way to specify the nic to use for the connection (So I can use a for loop to iterate thro... | false | 8,281,371 | 0.039979 | 0 | 0 | 1 | For the general case, there is no solution. Consider the case where the local machine is behind a machine with two IP addresses doing NAT. You can change your local interface to anything you like, but it's unlikely that you'll convince the NAT machine to make a different routing decision on its outgoing connections. | 0 | 5,595 | 0 | 5 | 2011-11-26T20:25:00.000 | python,networking,ip,nic | Python, How to get all external ip addresses with multiple NICs | 1 | 1 | 5 | 8,282,345 | 0 |
1 | 0 | I am working with a Python function that sends mails wich include an attachment and a HTML message......I want to add an image on the HTML message using
<img src="XXXX">
When I try it, the message respects the tag, but does not display the image I want (it displays the not found image "X").....
does anyone know if thi... | false | 8,301,501 | 0.099668 | 1 | 0 | 1 | You need to write src="cid:ContentId" to refer to an attached image, where ContentId is the ID of the MIME part. | 0 | 431 | 0 | 0 | 2011-11-28T19:53:00.000 | python,html,mime-types,sendmail,mime-message | Image in the HTML email message | 1 | 2 | 2 | 8,301,559 | 0 |
1 | 0 | I am working with a Python function that sends mails wich include an attachment and a HTML message......I want to add an image on the HTML message using
<img src="XXXX">
When I try it, the message respects the tag, but does not display the image I want (it displays the not found image "X").....
does anyone know if thi... | true | 8,301,501 | 1.2 | 1 | 0 | 1 | In your html you need the fully qualified path to the image: http://yourdomain.com/images/image.jpg
You should be able to take the URL in the image tag, paste it into the browser's address bar and view it there. If you can't see it, you've got the wrong path. | 0 | 431 | 0 | 0 | 2011-11-28T19:53:00.000 | python,html,mime-types,sendmail,mime-message | Image in the HTML email message | 1 | 2 | 2 | 8,301,539 | 0 |
1 | 0 | i'm working on a project thata i need develop one web service ( in java ) that get one simple number from a Corba python implementation... how can i proceed with this??
im using omniOrb and already done the server.py that genetares one simple number!
thx a lot | false | 8,310,262 | 0.664037 | 0 | 0 | 4 | You will need a Java CORBA provider - for example IONA or JacORB. Generate the IDL files for your python service and then use whatever IDL -> stub compiler your Java ORB provides to generate the java client-side bindings.
From there it should be as simple as binding to the corbaloc:// at which your python server is ru... | 0 | 375 | 0 | 0 | 2011-11-29T11:55:00.000 | java,python,web-services,corba | Corba python integration with web service java | 1 | 1 | 1 | 8,310,341 | 0 |
1 | 0 | I am using Selenium webdriver in Python for a web-scraping project.
How to print the HTML text of the selenium.WebElement ?
I intend to use the BeautifulSoup to parse the HTML to extract the data of interest.
Thanks | true | 8,316,152 | 1.2 | 0 | 0 | 12 | It's not possible to get the raw HTML from a WebElement.
You can get the page source from the browser object though: browser.page_source. | 0 | 7,324 | 0 | 6 | 2011-11-29T18:54:00.000 | python,selenium,beautifulsoup,web-scraping,urllib2 | Print HTML text of a selenium webelement in Python | 1 | 1 | 1 | 8,316,622 | 0 |
0 | 0 | I am trying to use the OAuth of a website, which requires the signature method to be 'HMAC-SHA1' only.
I am wondering how to implement this in Python? | false | 8,338,661 | 0 | 0 | 0 | 0 | In Python 3.7 there is an optimized way to do this. HMAC(key, msg, digest).digest() uses an optimized C or inline implementation, which is faster for messages that fit into memory. | 0 | 70,277 | 0 | 57 | 2011-12-01T08:55:00.000 | python,oauth,sha1,hmac | Implementation HMAC-SHA1 in python | 1 | 1 | 8 | 62,871,193 | 0 |
0 | 0 | I know how to parse a page using Python. My question is which is the fastest method of all parsing techniques, how fast is it from others?
The parsing techniques I know are Xpath, DOM, BeautifulSoup, and using the find method of Python. | false | 8,342,335 | 0.099668 | 0 | 0 | 1 | lxml was written on C. And if you use x86 it is best chose.
If we speak about techniques there is no big difference between Xpath and DOM - it's very quickly methods. But if you will use find or findAll in BeautifulSoup it will be slow than other. BeautifulSoup was written on Python. This lib needs a lot of memory for ... | 0 | 4,678 | 0 | 6 | 2011-12-01T13:45:00.000 | python,dom,xpath,html-parsing,lxml | Xpath vs DOM vs BeautifulSoup vs lxml vs other Which is the fastest approach to parse a webpage? | 1 | 1 | 2 | 8,342,483 | 0 |
0 | 0 | I wrote an API which which does some database operations with values requested by the API caller. How does this whole API system work when more than on person calls a function at the same time?
Do different instances of my API code start when a number of API calls are made?
If I need to handle like 2500 parallel API c... | false | 8,344,728 | 0 | 0 | 0 | 0 | Do you plan to call your python API from some other python code? If so then how is the parallelism achieved? Do you plan to spawn many threads, use your api in every thread?
Anyway it's worthwhile to take a look at multiprocessing module that allows one to create separate python processes. There are lots of threading ... | 1 | 177 | 0 | 0 | 2011-12-01T16:26:00.000 | python,api,parallel-processing | How to handle parallel calls to a Python API? | 1 | 1 | 1 | 8,345,037 | 0 |
0 | 0 | After running for a number of hours on Linux, my Python 2.6 program that uses urllib2, httplib and threads, starts raising this error for every request:
<class 'urllib2.URLError'> URLError(gaierror(-3, 'Temporary failure in name resolution'),)
If I restart the program it starts working again. My guess is some kind of r... | true | 8,356,517 | 1.2 | 0 | 0 | 18 | This was caused by a library's failure to close connections, leading to a large number of connections stuck in a CLOSE_WAIT state. Eventually this causes the 'Temporary failure in name resolution' error due to resource exhaustion. | 1 | 18,882 | 0 | 21 | 2011-12-02T12:45:00.000 | python,urllib2,httplib | Permanent 'Temporary failure in name resolution' after running for a number of hours | 1 | 1 | 2 | 8,376,268 | 0 |
1 | 0 | We have a glossary with up to 2000 terms (where each glossary term may
consist of one, two or three words (either separated with whitespaces
or a dash).
Now we are looking for a solution for highlighting all terms inside a
(longer) HTML document (up to 100 KB of HTML markup) in order to
generate a static HTML page with... | false | 8,366,909 | -0.066568 | 0 | 0 | -1 | How about going through each term in the glossary and then, for each term, using regex to find all occurrences in the HTML? You could replace each of those occurrences with the term wrapped in a span with a class "highlighted" that will be styled to have a background color. | 0 | 689 | 0 | 1 | 2011-12-03T09:59:00.000 | javascript,python,highlighting,glossary,glossaries | Highlighting glossary terms inside a HTML document | 1 | 1 | 3 | 8,366,996 | 0 |
0 | 0 | I have made a simple command-line URL downloader in Python. When the user supplies a URL it reads the file from web and saves it in a string, then saves the string in a file on the computer.
I want to add a progress bar. How should I go about it? | true | 8,397,667 | 1.2 | 0 | 0 | 2 | Figure out the total size of the file you're downloading. This is often present in the HTTP header Content-Length (which is in bytes).
Keep count of the total data downloaded so far.
The amount of the progress bar that should be filled at any moment is given by the formula: (downloaded so far) / (total size) which is a... | 0 | 428 | 0 | 2 | 2011-12-06T09:26:00.000 | python,command-line,download,progress-bar | How to add a progress bar in a Python command-line URL downloader? | 1 | 1 | 2 | 8,397,748 | 0 |
0 | 0 | I'm using urllib to open one site and get some information on it.
Is there a way to "open" this site only to the part I need and discard the rest (discard I mean don't open/load the rest)? | false | 8,409,372 | 0 | 0 | 0 | 0 | You should be able to read(bytes) instead of read(), this will read a number of bytes instead of all of it. Then append to already downloaded bytes, and see if it contains what you're looking for. Then you should be able to stop download with .close(). | 0 | 41 | 0 | 0 | 2011-12-07T01:37:00.000 | python,windows,urllib | Is there a way to use urllib to open one site until a specified object in it? | 1 | 1 | 2 | 8,409,568 | 0 |
0 | 0 | I want to run a selenium tests using python against a server farm that has about 50 web servers. What I have been doing is changing my host file (@ /etc/hosts) to switch to the desired server and run my selenium tests. This manual process can be tedious. Is there a better way to test these individual servers faster?
I... | false | 8,411,129 | 0 | 0 | 0 | 0 | use selenium2(webdriver) python binding ,does it make sense than change the server address in for loop ?
then it run in sequence way. | 0 | 618 | 0 | 0 | 2011-12-07T06:11:00.000 | python,testing,selenium,grid | Running Selenium Tests Against Server Farm using Python | 1 | 1 | 2 | 8,411,384 | 0 |
0 | 0 | Is it possible to upload file attachment with selenium in Python script? | false | 8,428,102 | -0.057081 | 0 | 0 | -2 | it is quite simple, just record it using IDE. Upload command is working | 0 | 7,807 | 0 | 3 | 2011-12-08T08:23:00.000 | python,file-upload,selenium,attachment | Upload file with Selenium in Python | 1 | 1 | 7 | 24,584,170 | 0 |
1 | 0 | I'm using python to develop a web app.
I defined both "get" and "post" method in the same request handler to serve different purpose. That is, I use "get" method to present a form to user, and "post" method to handle the submitted form.
It works fine, but is this approach appropriate? Or should I better define get and ... | true | 8,473,712 | 1.2 | 0 | 0 | 2 | Your approach is appropriate. According to the newest documentation you can even define post and get as functions outside request handler and just as other functions in your module and that's a way I would choose since it eliminates problems that can happen when instanciating request handlers.
If starting a new app fro... | 0 | 546 | 0 | 1 | 2011-12-12T11:38:00.000 | python,google-app-engine,webapp2 | Defining both post and get method under same request handler | 1 | 1 | 1 | 8,474,190 | 0 |
1 | 0 | Using ecs.py, I used to be able to get the reviews of a customer with a query like ecs.CustomerContentLookup(customerId, ResponseGroup='CustomerReviews').
This is now deprecated. Is there an alternative?
Thanks. | false | 8,483,263 | -0.197375 | 0 | 0 | -1 | Have you looked at using web page scraping to fetch/get the customer reviews / ratings?
If you know the customer id you should be able to extract all the information you need directly from the Amazon web pages. | 0 | 179 | 0 | 1 | 2011-12-13T01:24:00.000 | python,amazon-web-services | Is there a way to lookup all reviews of a customer in Amazon's new Product Advertising API? | 1 | 1 | 1 | 8,494,166 | 0 |
1 | 0 | How can i pool a connection to XMPP server in django so that it is available across multiple requests. I don't want to connect and authenticate on every request which makes it a bit slow. Is this possible?
EDIT:
I am using xmpppy python xmpp library | true | 8,500,455 | 1.2 | 0 | 0 | 2 | As xmpppy has its own main loop I suggest to use it in a separate thread or even start separately. Actually you do have two separate applications: website and xmpp-client and it is normal to run them separately.
In this case you may use different ways to communicate between your applications: pipes between threads and/... | 0 | 415 | 0 | 0 | 2011-12-14T06:44:00.000 | python,django,xmpp,connection-pooling | Django XMPP Connection pooling | 1 | 1 | 1 | 8,504,436 | 0 |
1 | 0 | I am using scrapy to crawl a site which seems to be appending random values to the query string at the end of each URL. This is turning the crawl into a sort of an infinite loop.
How do i make scrapy to neglect the query string part of the URL's? | false | 8,567,171 | 1 | 0 | 0 | 13 | There is a function url_query_cleaner in w3lib.url module (used by scrapy itself) to clean urls keeping only a list of allowed arguments. | 0 | 13,148 | 0 | 16 | 2011-12-19T20:31:00.000 | python,url,scrapy,web-crawler | How do I remove a query from a url? | 1 | 1 | 6 | 8,620,843 | 0 |
0 | 0 | How can I get paramiko to do the equivalent of setting "TCPKeepAlive yes" in ~/.ssh/config? | true | 8,588,506 | 1.2 | 1 | 0 | 2 | Got it: Transport.set_keepalive. Use in conjunction with the timeout argument to SSHClient.connect to set the socket timeout. | 0 | 383 | 0 | 2 | 2011-12-21T10:39:00.000 | python,ssh,paramiko | Can I enable TCPKeepAlive with paramiko? | 1 | 1 | 1 | 8,588,973 | 0 |
0 | 0 | I am new to Python programming and have covered sockets a bit. I couldn't find any simple implementation on the web. Its basic functionality should cover:
simple chat
file sharing
peer lookup
How do I start, and what should be the p2p model? I don't want to use any library such as Twisted, as it is complex. | true | 8,600,796 | 1.2 | 0 | 0 | 1 | You could write the library yourself, if you're willing to work with sockets directly. Have each node contain a list of peers that is regularly updated, and set each node to advertise its presence to a central server. You'd need to look into network traversal algorithms, hash tables, etc but it could be done. As Xavier... | 1 | 2,394 | 0 | 0 | 2011-12-22T07:47:00.000 | python,p2p | How to build a Python p2p application? | 1 | 2 | 2 | 8,603,939 | 0 |
0 | 0 | I am new to Python programming and have covered sockets a bit. I couldn't find any simple implementation on the web. Its basic functionality should cover:
simple chat
file sharing
peer lookup
How do I start, and what should be the p2p model? I don't want to use any library such as Twisted, as it is complex. | false | 8,600,796 | 0 | 0 | 0 | 0 | for the peer lookup I would begin with a simple central server and for simple chat and file sharing I would use a derivate of HTTP protocol. | 1 | 2,394 | 0 | 0 | 2011-12-22T07:47:00.000 | python,p2p | How to build a Python p2p application? | 1 | 2 | 2 | 8,601,303 | 0 |
0 | 0 | Given an id of any facebook group, using FQL I can fetch all the members of that group, if I am a member of that group. I can also see who of my friends is in the same group as me, that is also not a problem. Now, I need to see of all of the group members, who of them is friends, I mean, if there are 2 group members in... | false | 8,608,843 | 0.197375 | 0 | 0 | 1 | Without each of those friends giving you access to view who their friends are, it's impossible. If Facebook allowed this to happen without a friend granting you that access, then I'm going go scream from the hills about a HUGE security hole. | 0 | 4,952 | 0 | 0 | 2011-12-22T19:33:00.000 | python,facebook,facebook-fql | How to see mutual friendships in a facebook group? | 1 | 1 | 1 | 8,610,628 | 0 |
1 | 0 | I heard one can load a custom Firefox profile when starting webdriver, but I've yet to find a way to do that. The Python binding documentation doesn't state it very clearly.
I need to start up Firefox without JS because the site I'm testing has a lot of ads injected by Google and some are very slow to load, making the ... | false | 8,613,440 | 0 | 0 | 0 | 0 | You can use the -firefoxProfileTemplate command line option when starting the Selenium server. But it seems rather counterproductive to disable javascript when testing how browsers behave on your site (unless your site doesn't have any scripts of its own) - you should rather use adblock, or disable the IP used by Googl... | 0 | 1,288 | 0 | 1 | 2011-12-23T07:40:00.000 | javascript,python,selenium,automated-tests | How to load Firefox with javascript disable when running Selenium Webdriver (Python) tests? | 1 | 1 | 1 | 8,613,669 | 0 |
1 | 0 | I am scraping a webpage using Selenium webdriver in Python
The webpage I am working on, has a form. I am able to fill the form and then I click on the Submit button.
It generates an popup window( Javascript Alert). I am not sure, how to click the popup through webdriver.
Any idea how to do it ?
Thanks | false | 8,631,500 | 0 | 0 | 0 | 0 | that depends on the javascript function that handles the form submission
if there's no such function try to submit the form using post | 0 | 38,288 | 0 | 20 | 2011-12-25T20:50:00.000 | python,selenium,webdriver,web-scraping,alert | Click the javascript popup through webdriver | 1 | 1 | 6 | 8,631,520 | 0 |
0 | 0 | I have two computers on a network. I'll call the computer I'm working on computer A and the remote computer B. My goal is to send a command to B, gather some information, transfer this information to computer A and use this in some meaningfull way. My current method follows:
Establish a connection to B with paramiko.
... | false | 8,649,405 | 0 | 0 | 0 | 0 | I have been doing something similar on a larger scale (with 15 clients). I use the pexpect module to do essentially ssh commands on the remote machine (computer B). Another module to look into would be the subprocess module. | 0 | 2,292 | 0 | 1 | 2011-12-27T21:20:00.000 | python,rpc | How do I transfer data between two computers ? | 1 | 1 | 3 | 8,649,530 | 0 |
1 | 0 | I'm going to use ftplib to open up an FTP connection to an FTP server provided by the user. The client will be sending FTP commands to my django server via Ajax, which will then be forwarded to the FTP server the user provided. However, I'd like to not have to create a new FTP server connection every time the client s... | true | 8,663,391 | 1.2 | 0 | 0 | 0 | You'll need to use a persistent connection framework as what you're trying to achieve really isn't what HTTP was meant for (in the sense that HTTP commands are stateless and independent), and thus not what Django is built for. There are a number of options, but since it seems you are in a restricted environment you'll ... | 0 | 631 | 0 | 0 | 2011-12-29T02:24:00.000 | python,django,html,ftp | How to maintain server-initiated FTP connection between client requests in Python/Django? | 1 | 2 | 2 | 8,664,646 | 0 |
1 | 0 | I'm going to use ftplib to open up an FTP connection to an FTP server provided by the user. The client will be sending FTP commands to my django server via Ajax, which will then be forwarded to the FTP server the user provided. However, I'd like to not have to create a new FTP server connection every time the client s... | false | 8,663,391 | 0 | 0 | 0 | 0 | Switch hosts. Webfaction allows websockets with dedicated IP at around $20 per month. | 0 | 631 | 0 | 0 | 2011-12-29T02:24:00.000 | python,django,html,ftp | How to maintain server-initiated FTP connection between client requests in Python/Django? | 1 | 2 | 2 | 8,665,512 | 0 |
0 | 0 | We use Python 3.x in our projects. But the official client of Protocol Buffers only supports python 2.x.
I don't want to downgrade to python 2.x. | false | 8,663,468 | 1 | 0 | 0 | 6 | The latest version of Google Protocol Buffers (2.6) added Python 3 support. I suggest using that.
EDIT: Nevermind. They lied in their release notes. | 0 | 14,100 | 1 | 26 | 2011-12-29T02:43:00.000 | python,python-3.x,protocol-buffers | Is there any way to access Protocol Buffers with python 3.x? | 1 | 2 | 6 | 26,048,683 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.