473,598 Members | 2,844 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

uploading files to a webdav SSL enabled server

rbt
Has anyone used pure python to upload files to a webdav server over SSL?
I have no control over the server. I can access it with all of the
various webdav GUIs such as Konqueror, Cadaver, etc. by using a URL like
this:

webdavs://dav.hostname.co m/user_name/uploads

My goal is to upload files automatically with a python script. The
server requires authentication over SSL which I can do with urllib2 like
this:

def auth_against_ur l(url, username, password):

# This is a slightly modified version that I found here:
# http://simon.incutio.com/archive/2004/07/15/instant

import urllib2
import base64
request = urllib2.Request (url)
b64 = base64.encodest ring('%s:%s' % (username, password))[:-1]
request.add_hea der('Authorizat ion', 'Basic %s' % b64)
try:
f = urllib2.urlopen (request)
print f.read()
f.close()
return True
except urllib2.HTTPErr or, e:
print e
return False

auth_against_ur l('https://dav.hostname.co m/user_name/uploads',\
str.strip(raw_i nput('Enter User ID: ')),\
str.strip(raw_i nput('Enter Password: ')))

If urllib2 supported webdav, I think I'd be in business, but it doesn't.
Any one who can provide pointers on this? I've googled around to no
avail. I've began playing with Perl's HTTP::DAV and somone reccomended
PHP's curl functions as well, but I wanted to try this in Python first.

Many thanks,
rbt
Jul 19 '05 #1
2 4973
rbt wrote:
Has anyone used pure python to upload files to a webdav server over SSL?


We were not using SSL at the time (since it wasn't supported in standard
Python, as I recall), but we successfully used the webdav client that
was part of Zope a few years ago. I suspect you could adapt it to use
the new SSL support relatively easily. Check back for version 2.4 or so
if you can't find it in the latest Zopes. (I haven't looked at Zope for
a few years now, so I don't know whether it's still included.)

-Peter
Jul 19 '05 #2
rbt <rb*@athop1.ath .vt.edu> wrote in message news:<d7******* ***@solaris.cc. vt.edu>...
Has anyone used pure python to upload files to a webdav server over SSL?
I have no control over the server. I can access it with all of the
various webdav GUIs such as Konqueror, Cadaver, etc. by using a URL like
this:

webdavs://dav.hostname.co m/user_name/uploads
I suppose it would be nice if urllib(2) supported WebDAV in this way,
but you should still be able to use httplib to interact with the
server. Uploading in WebDAV is just a matter of doing an HTTP PUT if I
recall correctly, and I don't think that any of the special status
codes or responses are involved; in this sense WebDAV overlaps with
traditional HTTP.

[...]
If urllib2 supported webdav, I think I'd be in business, but it doesn't.
Any one who can provide pointers on this? I've googled around to no
avail. I've began playing with Perl's HTTP::DAV and somone reccomended
PHP's curl functions as well, but I wanted to try this in Python first.


Searching for "DAV Python" revealed the following projects:

http://www.lyra.org/greg/python/
http://cvs.infrae.com/packages/pydavclient/dav/

Really it's just a matter of talking HTTP to a server and parsing the
special messages that are returned for certain request methods, but
you may not even need to do that if you're just uploading files.

Paul
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
403
by: Independentsoft | last post by:
Hello, Independentsoft is pleased to announce the Release Candidate 2 of WebDAV .NET v1.0, the leading WebDAV protocol API component for Microsoft .NET Framework and Microsoft .NET Compact Framework. Download your full featured evaluation copy today at http://www.independentsoft.de/download.htm WebDAV .NET, the first component that allowed you to work with resources on
0
2224
by: Michael G. Schneider | last post by:
I just started playing around with WebDAV. The basic configuration is done and works. For example I am able to open a document via HTTP from within Word and save it. What I am really looking for is a way to integrate WebDAV into an ASP application. Initially I tought, that if WebDAV is enabled, a link such as http://server/app/test.doc would automatically open the document as a WebDAV document. However, this is not so. The document is...
0
1678
by: drasticp | last post by:
I want to create a custom webdav server by implementing IHttpHandler in my own class and firing it via IIS 6.0 Wildcard Application Maps. I have written my HttpHandler class implementing IHttpHandler. In the ProcessRequest method, I simply write a line to the Application Event Log stating what verb was requested. It doesn't work with a wildcard application map and a WebDav request. If I configure an extension specific map (.test for...
6
1640
by: subscriptions | last post by:
Hi, So here's the deal; I'm hosting several people on a virtual server running Linux (White Box Enterprise), each of which has an internet presence. (Apache webserver.) They're also web novices. I want to develop a method by which they can upload photos to a folder on the server from their client computer, without having to use FTP, creating the folder if necessary. This would be accessed from the client-side from a signed applet. ...
2
1261
by: D. Shane Fowlkes | last post by:
I'm about to build in some functionality where my client's staff can do some kind of basic upload to a folder or series of folders on our web server and allow authenticated users to know the UID and PWD to download these files. The needs are pretty simple and straight forward. But before I dive into screwing around with what already works on the server such as creating new UIDs and PWDs, new FTP sites, and so on...(not to mention...
4
15411
by: Shannon Hardin | last post by:
I'm trying to build a routine that will take a specified file from the user's local hard drive, and copy it to a remote server via WebDAV. I've tried using both HttpWebRequest and FileWebRequest, as outlined in some samples I found on MSDN and elsewhere, but so far have had no luck whatsoever. The copy process doesn't fail, but neither does the targeted file actually appear on the destination server. I have verified that I can copy...
0
1859
by: lknight643 | last post by:
I have an asp.net application that works with a SQL server database on server No. 1 but I want to upload files for storage to Server No. 2 that is accessible only from the Internet. If the file storage was on server No. 1, I would specify a physical file path (ChosenDirectory) for storage of the uploaded file but in my case I need to specify a virtual path like http://server2/folder1/. I'm trying to use server.mappath to convert the...
4
11084
by: DudDav | last post by:
Hi All, I have been trying to configured WebDAV on our current IIS server as an alternative to FTP and have had some mixed success but I've hit a brick wall with one problem. The server (Windows 2003 IIS 6) resides in the DMZ. I have created a virtual directory and directed it to a folder stored on the server. Integrated Windows Authentication and Basic Authentication has been enable along with SSL. I have added a handful of user account...
0
1311
by: teddy06 | last post by:
I have written code for read mails from exchange server. I have used webdav in my code. Its was working fine once upon a time. Currently configuration settings of client has been changed . so i am getting login timeout error. Can you pls help me out ? I dont know whether the WEBDAV is enabled or disabled.even i do not have access to enable it and see the configuration settings. pls provide some sample code for reading mails from...
0
7894
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8284
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8262
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6711
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5847
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5437
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3938
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1500
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1245
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.