On Aug 14, 11:57 am, brad [EMAIL PROTECTED] wrote:
Has anyone sent an xml payload via post using urllib?
Haven't used urllib, but have used urllib2 to do a POST.
Might something like this work...
import urllib2
logon_request = LoginRequest
passwordthe_password/password
Currently using the following technique in serveral client
applications to send a request message and receive a response:
import socket
bufferSize = 50
connectionHandle = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
connectionHandle.connect(sa)
connectionHandle.sendall(requestMessage)
When I review:
- the site that describes the SSLCrypto package:
http://www.freenet.org.nz/python/SSLCrypto/
- the documention for SSLCrypto:
http://www.freenet.org.nz/python/SSLCrypto/Doco/
- the examples provided
Operating system: Win XP
Version of Python: 2.4
I recognize that this question is not about Python...it has only a
tangential Python connection. I'm using a Python package to run a
process; that process is issuing an error, and I'm hoping that someone
on this site can point me to the site that
Marc 'BlackJack' Rintsch wrote:
`a` must be of length 32 for AES256. And the length of `plainText` must
be a multiple of 16 because it's a block cypher algorithm.
Thank you. I have some follow up questions and 1 tangential question.
Follow up question:
Would it be correct to infer that:
Sebastian 'lunar' Wiesner wrote:
Since you are apparently unable to read to docstrings of this module, I
will give you a short hint: yes, pycrypto supports AES with 256 bit
keys.
Thank you for the information.
The material I consulted was:
a) the PyCrypto manual:
Attempting to determine whether the PyCrypto package has the capability
to perform AES256 encryption. I received the following C# snippet:
CryptoProvider provider = new CryptoProvider();
Encrypted_Type password = new Encrypted_Type();
password.EncryptedData = new EncryptedDataType();
I am prompted to make these inquiries after seeing the following link
to ctypes:
http://docs.python.org/lib/module-ctypes.html
in which ctypes is described as a foreign function library.
What is the definition of foreign function library?
Is the concept different from a package?
Is the concept
I noticed the following lines from the connect() method of the
HTTPConnection class within httplib:
for res in socket.getaddrinfo(self.host, self.port, 0,
socket.SOCK_STREAM):
af, socktype, proto, canonname, sa = res
This led me to the
I am attempting to implement a process, and I'm pretty sure that a
major roadblock is that I do not understand the nomenclature. The
specs indicate that the goal is to calculate a message digest using an
SHA-256 algorithm. There are 2 examples included with the specs. The
label on the 2
Operating system: Win XP
Vsn of Python: 2.4
Situation is this: Required to calcluate a message digest. The process
for calcluating the digest must use an SHA-256 algorithm.
Questions:
1) Is it correct that the sha module comes with python 2.4?
2) Is it correct that the sha module that ships
Apologies in advance for what I'm sure seems like a trivial question.
Operating system: Win XP
Current version of Python: 2.4
If possible, I would like to have both Python 2.4 and Python 2.5
installed on my workstaiton. I downloaded the .msi for Python 2.5 from
the python.org site. If I run the
Was prompted to ask these questions when reading the following link:
http://effbot.org/zone/element-infoset.htm#mixed-content
provides a clear explanation of what the tail member is in the
elementtree package.
Questions:
1) In the xml world, is the text between an element's end tag and the
next
Operating system: Windows XP Home
Version of Python: 2.4
While looking through the tutorial on ElementSOAP at the following
link:
http://effbot.org/zone/element-soap.htm
I observed sample code that included:
from HTTPClient import HTTPClient
When I get into Pythonwin and attempt the import
Duncan Booth wrote:
wrote:
Does using an absolute URL for the url parameter help any? You've specified
a relative URL (i.e. the folder 12.5.81.49 under the current location).
I don't know the answer to that question. I know that when I'm on the
same workstation and I copy/paste the string
Duncan Booth wrote:
Are you really sure that the browser isn't making guesses about what you
meant and correcting the error for you? Does what remains in the address
bar when the page is retrieved really match *exactly* what you copied and
pasted?
Thank you for that pointer. The answer is:
O/S : Win2K
vsn of Python: 2.4
Hoping to find information that provide information about error
messages being encountered.
Pythonwin session:
import win32com.client
blah = win32com.client.Dispatch('MSXML2.XMLHTTP')
blah.open(POST, 12.5.81.49/crg_cbsil_vtest_52/crg.aspx, 0)
Traceback (most
O/S: Win2K
Vsn of Python: 2.4
Example:
a
b createAnotherWhenCondition=x
ctext for c/c
dtext for d/d
/b
e
ftext for f/f
gtext for g/g
/e
h
itext for i/i
j createAnotherWhenCondition=y
ktext for k/k
ltext for l/l
/j
mtext for m/m
/h
/a
Situation is this:
1) I have inherited some python code that accepts a string object, the
contents of which is an XML document, and produces a data structure
that represents some of the content of the XML document
2) The inherited code is somewhat 'brittle' in that some well-formed
XML documents
O/S WinXP Home
Vsn of Python: 2.4
Wish to install Amara. Using amara-allinone-1.0.win32-py2.4.exe
(2965KB)
Forder structure before installation:
c:
python24
DLLs
Doc
Include
Lib
site-packages
[previously installed stuff]
libs
scripts
tcl
tools
O/S: Windows XP Home
Vsn of Python: 2.4
Copy/paste of interactive window is immediately below; the
text/questions toward the bottom of this post will refer to the content
of the copy/paste
from elementtree import ElementTree
beforeRoot = ElementTree.Element('beforeRoot')
beforeCtag =
O/S: Win2K
Vsn of Python: 2.4
Here is copy/paste from interactive window of pythonwin:
x = Joe's desk
y = 'Joe\x92s desk'
type(x)
type 'str'
type(y)
type 'str'
print x
Joe's desk
print y
Joe's desk
if x == y:
... print 'equal'
... else:
... print 'not equal'
...
not equal
len(x)
Thank you. Yes, that post answers most of the questions. I now have a
bit of an understanding of the \xhh pattern. It's still unclear to me,
however, how one can go from the \x92 pattern and arrive at the
apostrophe character. Is \x92 theh apostrophe character in another
character set? If so,
1) It appears as if the following logic works for determining whether
an element is a parent:
# assume elem is an ElementTree element
if (elem.getchildren() == None):
print 'this element is not a parent'
else:
print 'this element is a parent'
My question is this: are there any other ways
Situation is this:
1) must write application that does the following:
a) creates an xml document, the contents of which, is a request
transaction
b) send xml document to destination; I am assuming that a process
at destination side processes the request and sends back a response
c)
Thank you for pointing me in the direction of XMLHTTP. I'm still
thinking about this in terms of creating a python script that is
functionally equivalent to the VB code in the original post. The
information I reviewed about XMLHTTP makes me think that it may be
possible to use the win32com.client
I observed something tangential to this topic, and that is the reason
for this reply. I don't understand when os.environ gets updated. The
'...captured the first time the os mdule is imported...' verbiage from
the following link:
http://www.python.org/dev/doc/newstyle/lib/os-procinfo.html
Fredrik Lundh wrote:
what part of your observations makes you think that the environment isn't
captured (i.e. copied from the process environment) when the os module is
imported ?
Answer: the part that was informed by a fundamental misunderstanding on
my part of how the os module obtains
O/S: Win2K
Vsn of Python:2.4
Based on a search of other posts in this group, it appears as though
os.environ['PATH'] is one way to obtain the PATH environment variable.
My questions:
1) is it correct that os.environ['PATH'] contains the PATH environment
variable?
2) are there other ways to
O/S: Windows 2K
Vsn of Python: 2.4
Currently:
1) Folder structure:
\workarea\ - ElementTree files reside here
\xml\
\dom\
\parsers\
\sax\
2) The folder \workarea\ is in the path.
3) A script (which is working) makes calls to the Element(),
SubElement(), tostring() and XML()
Can the **extra argument in the SubElement() factory in ElementTree be
used to set the text property? Example:
Want the text associated with the subroot tag to be xyz.
root
subrootxyz/subroot
/root
rather than:
root = Element('root')
subroot = SubElement(root, 'subroot')
subroot.text = 'xyz'
Mr. Boddie's suggestions work as indicated...many thanks.
It's not clear how a grep of the site-packages directory revealed the
most likely location of the ExpatError class is xml.parsers.expat.
Using XP's search utility, I searched for any files within the
c:\python24\ folder structure that had
Verion of Python: 2.4
O/S: Windows XP
ElementTree resides in the c:\python24\lib\site-packages\elementtree\
folder
When a string that does not contain well-formed XML is passed as an
argument to the XML() method in ElementTree.py, an ExpatError exception
is raised. I can trap the exception with
I do not understand how to use the find() method in ElementTree.
The file 'sample.xml' is:
?xml version=1.0?
SampleRoot
Header
ProductFindMystery/Product
/Header
SpecificInformation
SampleDetailabc/SampleDetail
/SpecificInformation
/SampleRoot
from
This may be more of a socket question than a python question; not sure.
Using this code to instantiate/connect/set options
connectionHandle = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
errorStatus = connectionHandle.connect_ex((ipAddress, port))
Version of python: 2.4
O/S: Win2K
I will be writing some python scripts to do some client-side
programming that involves socket.py. I expect that I will be making
calls to the following methods/functions:
connect_ex()
setsockopt()
sendall()
recv()
close()
Where can one find information about
When I look at how classes are set up in other languages (e.g. C++), I
often observe the following patterns:
1) for each data member, the class will have an accessor member
function (a Getwhatever function)
2) for each data member, the class will have a mutator member function
(a Setwhatver
If the class had two attributes--x and y--would the code look like
something lik this:
class C(object):
def __init__(self):
self.__x = 0
self.__y = 0
def getx(self):
return self.__x
def setx(self, x):
if x 0: x = 0
O/S - Windows XP Home with Service Pack 2
Vsn of Python: 2.4 (from ActiveState)
This question is with regard to the progress bar controls that are in
the file status.py. On my workstation, status.py is located in the:
c:\python24\lib\site-packages\pythonwin\pywin\dialogs\
folder.
The only
Where in the language would one find the intropsection capability to
answer the question: what class am I in?
Example:
class ExistentialCrisis:
def __init__(self, text):
self.spam = text
print 'In the constructor of the %s class' % whatever
When the constructor method is
O/S: Windows XP Service Pack 2
Python version: 2.4
Unable to understand how to build a class to handle an exception.
Contents of sample01.py:
import exceptions
class SampleMain:
try:
def __init__(self):
print 'in SampleMain constructor'
def Allowed(self):
Does Python provide some sort of mechanism for answering the question:
what method am I in?
Example: assume the file example1.py contains the following code:
def driver():
print 'hello world'
print __name__
print 'the name of this method is %s' % str(???)
The output I'd like to see
O/S: Windows XP Home (with Service Pack 2)
Downloaded python-2.4.msi from python.org (10,632KB). When I double
click on the file from Windows Explorer, the installation process
presents the window in which I am prompted to either install for all
users (the default) or install for just me. I
43 matches
Mail list logo