How to download a file behind a HTTPS login?
How would you go about downloading a webpage file behind an HTTPS login via a language such as python? More specifically I am talking about the page behind the login from http://www.cnbtn.com. ...
How would you go about downloading a webpage file behind an HTTPS login via a language such as python? More specifically I am talking about the page behind the login from http://www.cnbtn.com. ...
Using comtypes to drive Python, it seems some magic is happening behind the scenes that is not converting tuples and lists to VARIANT types: # RANGE(“C14:D21”) has values # Setting the Value on the Range with a Variant should work, but # list or tuple is not getting converted properly it seems >>>from comtypes.client import CreateObjec...
I have an application application framework that works in a peer-to-peer manner between unnamed hosts on a network. I want to have the traffic be encrypted, so I've implemented a setup with M2Crypto, but I've run into a snag. I have no idea what to put down for 'commonName' when creating the cert. It seems to want a domain name, but none...
How would you find the signed angle theta from vector a to b? And yes, I know that theta = arccos((a.b)/(|a||b|)). However, this does not contain a sign (i.e. it doesn't distinguish between a clockwise or counterclockwise rotation). I need something that can tell me the minimum angle to rotate from a to b. A positive sign indicates a ...
Hi all, I'm interested to build a fast server that serves queries on time series. For example, say I have 1000 time series identified by category name x. The server will take a query submitted by a client process and immediately return the last value associated with a particular timestamp. For example on the client script, someone woul...
What is the most efficient way to shift a list in python? Right now I have something like this: >>> shift = lambda l, n: l[n:]+l[:n] >>> l = [1,2,3] >>> shift(l,1) [2, 3, 1] >>> shift(l,2) [3, 1, 2] >>> shift(l,0) [1, 2, 3] Is there a better way? ...
I finally managed to change the background of a textview widget in pygtk. Turns out I needed to use the widget.modify_base(gtk.STATE_NORMAL, gtk.gdk.Color(0, 0, 0, 0)) That results in the desired black background. Now, the rest of the problem... Now I want to change the text color to white. I have tried everything including widget.modi...
Hi just considering starting to learning python but I have one concern before I invest more time. Let me phrase this as a statement followed by a concern for others to comment on as perhaps the assumptions in the statement are invalid: I have read about GIL and the consensus seems to be if you require concurrent solutions in python you...
I've got key-press-event handler and i need to determine which kind of key was pressed: modifier or not? It's not in event.state, because this field works only when modifier was pressed with something else, but i need this for single key (i.e. simply pressing control or alt, ...). ...
Maybe I'm going about this the wrong way, but I want to parse a single "catch all" email inbox via Python. I see the email module and I can make it parse an individual email, but what I want to do is open (for example) /var/spool/mail/catchall and parse all of the individual messages inside it. Opening that file and running the parser ov...
There are multiple posts on here that capture value, but I'm just looking to check to see if the value is something. More vaguely put; I'm looking to understand the difference between checking a value, and "capturing" a value. In the current case the value would be the following acceptable money formats: Here is a post that explains som...
In Django, I've got a Checkout model, which is a ticket for somebody checking out equipment. I've also got an OrganizationalUnit model that the Checkout model relates to (via ForeignKey), as the person on the checkout belongs to an OrganizationalUnit on our campus. The OrganizationalUnit has a self relation, so several OUs can be the ch...
I have a file. In Python, I would like to take its creation time, and convert it to an ISO time (ISO 8601) string while preserving the fact that it was created in the Eastern Time Zone. How do I take the file's ctime and convert it to an ISO time string, that indicates the Eastern Time Zone (and takes into account daylight savings time,...
Using lxml.objectify like so: from lxml import objectify o = objectify.fromstring("<a><b atr='someatr'>oldtext</b></a>") o.b = 'newtext' results in <a><b>newtext</b></a>, losing the node attribute. It seems to be directly replacing the element with a newly created one, rather than simply replacing the text of the element. If I try ...
I have a project called Foo/ that has buildout.cfg and setup.py. Now there is another project called Bar/ .. which too has buildout.cfg and setup.py. Since Bar/ depends on various Python modules, it has install_requires=['lxml', 'SQLAlchemy'] in its setup.py. Foo/ depends on Bar/. But Bar/ does not have a release yet. How do I include B...
Using Python and PyGTK I've got a GtkMenu with various GtkCheckMenuItems in it. When the user clicks one of the checkboxes the menu closes. I'd like for the user to be able to check a series of checkboxes without the menu closing each time. I've looked at using the activate callback to show the menu but this doesn't seem to work. Any ...
My own answer to this question is YES, but I'd like to hear from others. Put another way the question could be: Would the success of 1-click-install WordPress (not WordPress.com, which is SaaS) be possible if it weren't written in PHP, all other things being equal? The critical associated requirements I believe support PHP are: hosti...
What's the best way to spell check strings and comments inside Python source code? ...
Okay so basically I'm trying to do a depth-first search for a mini-peg solitaire game. For those unfamiliar with the game it's pretty simple. There's a board with 10 holes and 9 pegs, a peg is represented by a 1 and an empty spot by a 0. You can move a peg backwards or forwards two holes at a time (but you can only move to an empty ho...
How can I use BeautifulSoup to find all the links in a page pointing to a specific domain? ...