Skip to content

Instantly share code, notes, and snippets.

@chrisgeo
Created June 28, 2012 03:03
Show Gist options
  • Save chrisgeo/3008600 to your computer and use it in GitHub Desktop.
Save chrisgeo/3008600 to your computer and use it in GitHub Desktop.
Delicious CSV Import Script
#!/usr/bin/env python
import csv
import httplib2
import time
from urllib import urlencode
add_url = 'https://api.del.icio.us/v1/posts/add?%s'
ifile = ''
headers = {'User-Agent': 'Delicious CSV Import'}
bookmarks = csv.DictReader(open(ifile, 'r'))
for row in bookmarks:
post_dict = {}
post_dict['url'] = row['URL']
post_dict['description'] = row['Title']
post_dict['tags'] = row['Folder']
post_dict['replace'] = 'no'
print post_dict
h = httplib2.Http()
h.add_credentials(username, pass)
params = urlencode(post_dict)
resp, content = h.request(add_url % params, "GET", headers=headers)
print resp
print content
#they ask us to pause for at least a second, give them 2 to be kosher.
time.sleep(2)
@JiDai
Copy link

JiDai commented Sep 3, 2013

How to use it, can you specify an example of command line ?
Thanks!

EDIT : I found. Import succeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment