Hi,
I'm having little trouble creating a script working with URLs. I'm using urllib.urlopen() to get content of desired URL. But some of these URLs requires authentication. And urlopen prompts me to type in my username and then password.
What I need is to ignore every URL that'll require authentication, just easily skip it and continue...
I apologize if this is a duplicate question, I searched a bit and couldn't find anything similar - I have a Python library that connects to my C# application via a socket in order to allow simple Python scripting (IronPython isn't an option right now for a couple of reasons). I would like to create a Windows Forms control that would be b...
I'm using the Django ORM in a non-Django application and would like to turn on the DEBUG setting so that I can periodically log my queries. So I have something vaguely like this:
from django.db import connection
def thread_main_loop():
while keep_going:
connection.queries[:] = []
do_something()
some_logging...
Just wondering what the run time of lookup for set() is? O(1) or O(n)?
if I have
x = set()
whats the runtime of
if "a" in x:
print a in set!
...
I'm writing a Python extension that runs through a Py_UNICODE array, finds specific (ASCII, if it matters) characters, i.e. '\' or '\n', and does some additional stuff for each one that it finds.
Is there a way to write those characters as literals? If not, what is the correct way to obtain Py_UNICODEs for them, keeping in mind that Py...
using regedit.exe I have manually created a key in registry called
HKEY_CURRENT_USER/00_Just_a_Test_Key
and created two dword values
dword_test_1 and dword_test_2
I am trying to write some values into those two keys using following program
import _winreg
aReg = _winreg.ConnectRegistry(None,_winreg.HKEY_CURRENT_USER)
aKey = _winreg.O...
I am using Popen function from the subprocess module to execute a command line tool:
subprocess.Popen(args, bufsize=0, executable=None, stdin=None, stdout=None, stderr=None, preexec_fn=None, close_fds=False, shell=False, cwd=None, env=None, universal_newlines=False, startupinfo=None, creationflags=0)
The tool I am using takes a list o...
when i input some texts/strings, i want them to appear either as hidden or with some special characters(as we do while entering password). . . how can i implement it in a python program?
pls help me.
...
Hi,
What is the pythonic way of writing a unittest to see if a module is properly installed? By properly installed I mean, it does not raise an ImportError: No module named foo.
...
Hi there,
I'm trying to access my google talk contacts' custom status messages with xmpppy. I'm made it this far:
import xmpp
import sys
userID = '[email protected]'
password = 'mypassword'
ressource = 'Script'
jid = xmpp.protocol.JID(userID)
jabber = xmpp.Client(jid.getDomain(), debug=[])
connection = jabber.connect(('talk.goog...
Python documentation to Popen states:
Warning Use communicate() rather than .stdin.write, .stdout.read or .stderr.read to avoid deadlocks due to any of the other OS pipe buffers filling up and blocking the child process.
Now, I'm trying to figure out how this deadlock can occur and why.
My mental model: subproccess produces someth...
Using Python I would like to find the date object for last Wednesday. I can figure out where today is on the calendar using isocalendar, and determine whether or not we need to go back a week to get to the previous Wednesday. However, I can't figure out how to create a new date object with that information. Essentially, I need to figu...
Reading the documentation it seems this might not be possible, but it seems that a lot of people have been able to beat more complicated functionality into pythons lambda function.
I'm leveraging the scapy libraries to do some packet creation. Specially this questions is about the ConditionalField which takes it a field and a compariso...
I've tried asking this question on the KDE development forum, but haven't received a satisfying answer so far.
I've developed a Python script for Amarok 1.4 which retrieves upcoming events for the currently playing artist and displays them in the context browser. The user can click each event to know more about it, but so far clicking ...
I'm new to Python, so forgive me if I am missing something obvious.
I am using urllib.FancyURLopener to retrieve a web document. It works fine when authentication is disabled on the web server, but fails when authentication is enabled.
My guess is that I need to subclass urllib.FancyURLopener to override the get_user_passwd() and/or p...
How do I add complex types to a SOAP request?
I'm using WSDL2py generated requests, and trying to use the other TypeDefinitions that it made in the *_types.py file (like AccountInfo, for authentication, that goes into every request). Then passing it the wsdl2py generated server, and I'm getting this error:
>>> from AutomotiveDescriptio...
Following suggestions, I am converting my project to declarative sqlalchemy class definitions. This allows me to define relations as strings ( a=relation('myotherclass'), instead of relation(myotherclass) ), and avoid cross importing issues.
My question is how do I define column_properties the same way.
This is sort of what I have (no...
I want to take a list [0,1,2] and turn it into [0,1,2,2,1,0]. Right now, I've got
r = list(mus)
r.reverse()
mus = mus + r
but it seems like there should be a better way. Can anyone come up with a good, pythonic one-liner?
...
I was just playing around with the python command line and the ** operator, which as far as I know performs a power function. So 2 ** 3 should be (and is) 8 because 2 * 2 * 2 = 8.
Can someone explain the behavior I found? I don't see any way to group the operations with parentheses to actually get a result of 65536 like was attained h...
Hi All,
One of my URLs is for a tracking cookie. In the basic configuration, the pylons controller parses the query string, does a DB query, and sets the cookie accordingly.
I want to move to nginx. I am wondering if this is possible:
nginx fetches value of cookie from memcached
nginx writes the headers and serves static file
nginx r...