Giter VIP home page Giter VIP logo

pydelicious's Introduction

pydelicious

From del.icio.us to Python. Based on work done by Frank Timmermann[1]. See license.txt.

Installation:

% python setup.py install

And either import the (documented) class:

>>> from pydelicious import DeliciousAPI
>>> api = DeliciousAPI('username', 'password', 'encoding')

or use the functions on the module, listed below. Please do report any bugs.

Overview

Access to the del.icio.us web service API is implemented in pydelicious.py. In addition the script tools/dlcs.py can manage a local collection of bookmarks.

The API class can be used directly:

>>> from pydelicious import DeliciousAPI; from getpass import getpass
>>> pwd = getpass('Pwd:')
Pwd:
>>> a = DeliciousAPI('user', pwd)
>>> # Either succeeds or raises DeliciousError or subclass:
>>> a.posts_add("http://my.com/", "title", extended="description", tags="my tags")
>>> len(a.posts_all()['posts'])
1
>>> a.tags_get() # or: a.request('tags/get')
{'tags': [{'count': '1', 'tag': 'my'}, {'count': '1', 'tag': 'tags'}]}
>>> a.posts_update()
{'update': {'time': (2008, 11, 28, 2, 35, 51, 4, 333, -1)}}
>>> # Either succeeds or raises DeliciousError or subclass:
>>> a.posts_delete("http://my.com/")
>>> len(a.posts_all()['posts'])
0

Or by calling one of the methods on the module. These are functions that wrap common API calls. The signature is 'user', 'passwd' followed by the API method arguments.

These are short functions for getrss calls:

Documentation

For code documentation see doc/pydelicious or doc/dlcs.py. For TODO's, progress reports, etc. see HACKING.

Note that for non-pydelicious related questions there is also a del.icio.us user discussion list at yahoo.

Historical

Originally written by Frank Timmermann and hosted at: <http://deliciouspython.python-hosting.com/> (defunkt).


[1]Google Code, pydelicious (http://code.google.com/p/pydelicious/).

pydelicious's People

Watchers

 avatar

pydelicious's Issues

Waiter wait too much

If the last call was less then DLCS_TIME_WAIT, Waiter wait full DLCS_TIME_WAIT 
seconds instead of 
difference.

Attached patch.


Original issue reported on code.google.com by [email protected] on 29 Oct 2007 at 7:40

Attachments:

Makefile is borked and should be replaced by setup.py

What steps will reproduce the problem?
1. run make 

What is the expected output? What do you see instead?
The expected output is something that builds and installs pydelicious.
Instead I get a bunch of errors. 

In fact, I'm not sure a Makefile is needed at all given that most python
modules use setup.py to do what the makefile is trying to do. Thoughts and
discussion are welcomed.

Please use labels and text to provide additional information.
makefile

Original issue reported on code.google.com by [email protected] on 5 Oct 2007 at 3:21

dlcs_rss_request() does not work

What steps will reproduce the problem?

Call any of the functions which are based on dlcs_rss_request()i. e.
get_popular(), get_urlposts(), ...

What is the expected output? What do you see instead?

An empty list is returned as result. 

Debugging reveals that the links which are used by dlcs_rss_request() are 
broken.

Original issue reported on code.google.com by [email protected] on 6 Oct 2011 at 7:49

pydelicious under google app engine

What steps will reproduce the problem?
1. Code up an app engine module complete with deps
2. Test locally - works ok
3. Deploy to app engine

What is the expected output? What do you see instead?
Bookmarks added, but instead delicious always returns #403 - Forbidden

What version of the product are you using? On what operating system?
http://www.facebook.com/event.php?eid=62187991351&ref=mf

Please provide any additional information below.
Everything seems to work fine on local test, but fails when deployed to
google app engine server. Sure it's something in the app engine
environment, but am new to python. Any pointers as to how to fix this would
be really appreciated. Many thanks.

Original issue reported on code.google.com by [email protected] on 15 Feb 2009 at 6:22

Dependencies

This might save someone a min or 2.

sudo easy_install feedparser
sudo python setup.py install

any chance of easy_install pydelicious? :)

Original issue reported on code.google.com by [email protected] on 2 Nov 2007 at 4:46

pydelicious does not work with python 2.5

Python 2.5 now includes the elementTree module, so a fresh install of
python 2.5 should work right out of the box with pydelicious. This is not
currently the case as pydelicous thinks that elementTree only lives in one
place. 

What steps will reproduce the problem?
1. download pydelicious 
2. At the python prompt, try to import the module:

 In [1]: import pydelicious
---------------------------------------------------------------------------
<type 'exceptions.ImportError'>           Traceback (most recent call last)

     92 from StringIO import StringIO
     93 #from  xml.etree.ElementTree import parse as parse_xml
---> 94 from elementtree.ElementTree import parse as parse_xml
     95 #import feedparser
     96

<type 'exceptions.ImportError'>: No module named elementtree.ElementTree


What version of the product are you using? On what operating system?
This is version 0.5.0, svn rev 5.

Please provide any additional information below.
I've attached a patch which does a simple conditional import.

Original issue reported on code.google.com by [email protected] on 27 Sep 2007 at 5:54

Attachments:

Allow for importing of pydelicious without necessarily having feedparser lib

A large chunk of the pydelicious library - especially the API portion has 
no dependency on feedparser  (from what I can see the feedparser module is 
only used in dlcs_rss_request). However, because  the 'import feedparser' 
statement is within the module scope - the feedparser module is always 
required.

I was wondering if it be possible that we move the import feedparser 
statement to within the dlcs_rss_request function? I do think allowing for 
segments of pydelicious to be used with the minimal of dependencies, will 
make it an even more attractive library. What do you think?

Thanks for this excellent library.

Mohan

Original issue reported on code.google.com by [email protected] on 26 Oct 2008 at 3:27

ElementTree and the Universal Feed Parser are included in version control

What steps will reproduce the problem?
1. Fresh svn checkout from http://pydelicious.googlecode.com/svn/trunk/
2. Notice that the elementtree and feedparser python modules are included
in the checkout

What is the expected output? What do you see instead?
I would expect those libraries to be listed as dependencies, instead.  You
don't really want to track changes to those external libraries, do you?

Original issue reported on code.google.com by mccutchen on 20 Oct 2006 at 4:25

Can't use API with yahoo id (user id as an email) !

What steps will reproduce the problem?
1. Create a new del.icio.us account with a yahoo id.
2. Try to use pydelicious to save a new bookmark.

What is the expected output? What do you see instead?
Expected: Bookmark to be added successfully.
Instead: HTTP Error 401: Unauthorized


What version of the product are you using? On what operating system?
0.5.0.


Original issue reported on code.google.com by [email protected] on 14 Nov 2009 at 12:25

Only one tag returned by older API methods

What steps will reproduce the problem?
1. Fetch a bookmark with get_popular or other old API functions

What is the expected output? What do you see instead?

The tags field should have multiple tags. Instead it always has only one tag.

The file attached has the issue solved. For some reason e['categories'] was 
being used instead of e['tags'].

Is this how I'm suppose to submit issues?


Original issue reported on code.google.com by [email protected] on 21 Jun 2013 at 3:27

Attachments:

pydelicious should throw exceptions for errors

Currently pydelicious handles errors like a C library; the functions return
values and the app is supposed to check them for error. Ie, "addPost"
returns True on success and something else on failure. This is unPythonic;
the code should be reworked to throw exceptions indicating failures. This
change will break some existing programs.

Original issue reported on code.google.com by [email protected] on 17 Feb 2007 at 6:39

timeoutsocket

Currently this comment sits in the code:

{{{

 timeoutsocket allows feedparser to time out rather than hang forever on
ultra-slow servers. Python 2.3 now has this functionality available in the
standard socket library, so under 2.3 you don't need to install anything. 
But you probably should anyway, because the socket module is buggy and
timeoutsocket is better.

}}

Looking into this, finding mention at
http://bytes.com/topic/python/answers/24457-timeoutsocket-py about the
integration on 2.3.

I hope to keep this compatible, even while this issue is quite old (~2001).

Also, it seems it may be a bit hard to get a up-to-date version of the package.
http://www.timo-tasi.org/python/timeoutsocket.py



Original issue reported on code.google.com by [email protected] on 24 Apr 2010 at 4:58

*.pyc files are included in svn

What steps will reproduce the problem?
1. Do a fresh checkout from http://pydelicious.googlecode.com/svn/trunk/
2. Notice that __init__.pyc, elementtree/__init__.pyc, etc., are included
in version control

What is the expected output? What do you see instead?
I did not expect to have .pyc files included in version control.  Instead,
they were.

What version of the product are you using? On what operating system?
svn trunk as of 2006-10-20, 11:15 a.m. CST on Windows XP SP2 and Python
2.4.something.


Please provide any additional information below.


Original issue reported on code.google.com by mccutchen on 20 Oct 2006 at 4:23

ImportError: No module named tools.dlcs

What steps will reproduce the problem?
1. sudo easy_install pydelicious
2. dlcs -u "username"
3.

What is the expected output? What do you see instead?
Traceback (most recent call last):
  File "/usr/local/bin/dlcs", line 9, in <module>
    load_entry_point('pydelicious==0.6', 'console_scripts', 'dlcs')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 351, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2363, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2088, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
ImportError: No module named tools.dlcs


What version of the product are you using? On what operating system?
pydelicious 0.6


Please provide any additional information below.
I am new to pydelicious. I am using ubuntu14.04. I have just installed it. 

Original issue reported on code.google.com by [email protected] on 6 Jan 2015 at 3:30

Tabs vs. Spaces

Not strictly a problem but an issue to be resolved.

pydelicious.py uses spaces for indentation (mostly, but a quick look just
now shows its a mix... goodness...)

my own preference leans towards tabs, now used in tests/* and tools/*

*Votes for tabs or spaces please?* Or does the project owner which to have
veto right? :)

I vote for using tabs throughout all of the code.


mvrgr, Berend

Original issue reported on code.google.com by [email protected] on 15 Oct 2007 at 3:49

pydelicious svn installs, but can't import pydelicious

What steps will reproduce the problem?
1. pydelicious svn checkout or git-svn clone
2. virtualenv python 2.6, install pip
3. pip install -e /path/to/pydelicious (or easy_install)

What is the expected output? What do you see instead?

I went for an svn checkout (git svn clone actually), because the download
links on PyPI for pydelicious did not work as of 2009-10-14.

pip -e (or easy_install) installs correctly, i.e. feedburner is pulled in
as dependency. When you attempt to import pydelicious, you get an error:

>>> import pydelicious
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named pydelicious
>>> 

What version of the product are you using? On what operating system?

pydelicious svn r53

Please provide any additional information below.

If you rename the directory src/ to pydelicious/ and also in setup.py
replace instances of "src" with "pydelicious", the problem goes away.

Original issue reported on code.google.com by [email protected] on 14 Oct 2009 at 10:10

posts_all error

$ python
Python 2.4.4 (#1, Jan 25 2008, 01:23:50)
[GCC 4.1.2 (Gentoo 4.1.2 p1.0.2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pydelicious import *
>>> from getpass import *
>>> u=getpass("Username: ")
Username:
>>> p=getpass("Password: ")
Password:
>>> api=apiNew(u,p)
>>> posts=api.posts_all()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/pydelicious.py", line 663, in 
posts_all
    return self.request("posts/all", tag=tag, **kwds)
  File "/usr/lib/python2.4/site-packages/pydelicious.py", line 554, in 
request
    fl = self._call_server(path, **params)
  File "/usr/lib/python2.4/site-packages/pydelicious.py", line 522, in 
_call_server
    return self._api_request(path, params, self.user, self.passwd)
  File "/usr/lib/python2.4/site-packages/pydelicious.py", line 338, in 
dlcs_api_request
    return http_auth_request(url, DLCS_API_HOST, user, passwd, USER_AGENT)
  File "/usr/lib/python2.4/site-packages/pydelicious.py", line 311, in 
http_auth_request
    return http_request(url, user_agent)
  File "/usr/lib/python2.4/site-packages/pydelicious.py", line 284, in 
http_request
    raise PyDeliciousException, "%s" % e
pydelicious.PyDeliciousException: HTTP Error 503: Service Temporarily 
Unavailable

I'm currently use: pydelicious-0.5.0

Thank you
Alberto



Original issue reported on code.google.com by [email protected] on 3 Feb 2008 at 3:13

small bug in the convenience "get" function if using the count parameter

if one does a pydelicious.get("a", "b", count=3), for example, pydelicious 
throws an error, because it 
tries to get the list-subset from the enclosing dictionary:

if count != 0: posts = posts[0:count]

since posts is no list but a dict, this obviously doesn't work. the fix is as 
follows:
if count != 0: posts["posts"] = posts["posts"][0:count]

Original issue reported on code.google.com by [email protected] on 26 Apr 2008 at 1:40

Change in text encoding detection in ver 0.5.2-rc1 results in error as locale.getpreferredencoding() does not always return a useful result

Hello,

In ver 0.5.2-rc1 (in contrast to version 0.5) the encoding is determined
via a call to locale.getpreferredencoding() unless its explicitly specified
in the DeliciousAPI constructor.

This however can results in an error because sometimes an empty string is
returned as the result. (I get this on my Mac OS X 10.5 machine using the
Apple provided python.) In pydelicious 0.5 the codec was defaulted to
'iso-8859-1' if not provided, hence I had no such issues. Maybe some sane
default or explicit error detection up front is required? Might save some
developer some debugging time :).

Just my 2 cents. 

Original issue reported on code.google.com by [email protected] on 31 Jan 2009 at 6:48

HTTP Error 404: Not Found

What steps will reproduce the problem?
1. import pydelicious
2. pydelicious.get_popular(tag='programming')
3.

What is the expected output? What do you see instead?
A list of dictionary. But I see the next error message

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/pydelicious-0.6-py2.7.egg/pydelicious/__init__.py", line 985, in get_popular
    return getrss(tag=tag, popular=1)
  File "/usr/lib/python2.7/site-packages/pydelicious-0.6-py2.7.egg/pydelicious/__init__.py", line 969, in getrss
    return dlcs_rss_request(tag=tag, popular=popular, user=user, url=url)
  File "/usr/lib/python2.7/site-packages/pydelicious-0.6-py2.7.egg/pydelicious/__init__.py", line 447, in dlcs_rss_request
    rss = http_request(url).read()
  File "/usr/lib/python2.7/site-packages/pydelicious-0.6-py2.7.egg/pydelicious/__init__.py", line 227, in http_request
    raise PyDeliciousException, "%s" % e
pydelicious.PyDeliciousException: HTTP Error 404: Not Found


What version of the product are you using? On what operating system?
pydelicious-0.6 and I have a 'gentoo' Linux

Please provide any additional information below.
I have the "programming Collective Intelligence" book and would like to use the 
del.icio.us API.



Original issue reported on code.google.com by [email protected] on 28 Sep 2011 at 5:40

Mismatch of the return value of pydelicious.get_popular()

What steps will reproduce the problem?
1. install feedparser
2. install pydelicious
3. pydelicious.get_popular(tag='python')

What is the expected output? What do you see instead?

I want to see a dictionary of python tag.
Get a xml document instead.

What version of the product are you using? On what operating system?

feedparser-5.0.1.zip
pydelicious-0.6.zip

WindowsXP 
Please provide any additional information below.

something like this : <?xml version="1.0" encoding="UTF-8"?>\n<rdf:RDF 
xmlns="http://purl.org/rss/1.0/" 
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
xmlns:content="http://purl.org/rss/1.0/modules/content/"

Original issue reported on code.google.com by [email protected] on 28 Jul 2011 at 10:30

Add support for the JSON API

In addition to the XML API that pydelicious supports, delicious also has a
JSON API for doing certain things:
http://del.icio.us/help/json/

Some of the functions are overlaps with what's in the XML, but some (like
url) are unique to JSON. None of the JSON functions seem to require
authentication, so it's pretty trivial to hack it up. The main value-add
would be choosing a JSON library so that delicious developers don't have to
think about that.

Before putting a lot of work into this it'd be nice to learn what the
development plans are for the delicious API.

Original issue reported on code.google.com by [email protected] on 17 Feb 2007 at 4:20

Improper error on bad user

It took me ages to figure out what was going on, but apparently when a bad 
username/password combination is given to pydelicious it will return a 
PyDeliciousThrottled exception, which is quite a bit misleading.

Original issue reported on code.google.com by [email protected] on 10 Feb 2010 at 10:49

New del.icio.us API does not fetch posts/all?

del.icio.us latest updates cause the following API path not to return any
XML data anymore:

 https://api.del.icio.us/v1/posts/all

Perhaps this has something to do with the size of my posts list. 
*Can anyone confirm this?*

E.g.:

>>> pydelicious.get_all(user, passwd)
(raises expat exception since there is no XML data available)

-or-

>>> pydelicious.DeliciousAPI(user, passwd).posts_all(_raw=True).read()
'<!-- fe02.api.del.ac4.yahoo.net uncompressed/chunked Fri Aug  8 06:50:45
PDT 2008 -->\n'

Solution
It seems that from now on the the URL query parameter 'hashes' should be
used for this API function. This will return a posts list with md5sums for
URL's and some other hash for the metadata. I.e.

<posts><post meta="56e71db30dc5cd617db01d440c967808"
url="200305b637e4ce457dcc9af78359436b"/></posts>

With this data the post(s) can be retrieved using
posts/get?hashes=<md5sum>[+<md5sum>]

A new option to retrieve the meta hash is also provided.
I'm not clear on how the meta hash is made. Presumably it is the md5sum of
some notation of the post attributes. I'll contact del.icio.us about this.

I will adapt the DeliciousAPI class for the new options while I'm writing a
script that can synchronize bookmarks with a local MySQL database.

Original issue reported on code.google.com by [email protected] on 8 Aug 2008 at 2:04

Make encoding tests fails

What steps will reproduce the problem?
1. $ python pydelicioustest.py
Username (hit return to skip api test):[username]
Passwd (hit return to skip api test):[password]

What is the expected output? What do you see instead?
Expected test success. instead saw

.............EE.....
======================================================================
ERROR: teststr2uni (__main__.TestHelperFunctions)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "pydelicioustest.py", line 34, in teststr2uni
    t = {'a':u'a', u'a':u'a', 'ä':u'\xe4', u'ä':u'\xe4'}
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 0: ordinal
not in range(128)

======================================================================
ERROR: teststr2utf8 (__main__.TestHelperFunctions)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "pydelicioustest.py", line 38, in teststr2utf8
    t = {'a':'a', u'a':'a', 'ä':'\xc3\xa4', u'ä':'\xc3\xa4'}
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 0: ordinal
not in range(128)

----------------------------------------------------------------------
Ran 20 tests in 136.757s

FAILED (errors=2)



What version of the product are you using? On what operating system?

Downloaded from SVN today. Ran on cygwin using Python 2.5b2.

Please provide any additional information below.

Currently seeing 10 errors in Windows tests with 2.4.2 as well, but have
not yet had time to examine them.

Original issue reported on code.google.com by [email protected] on 20 Sep 2006 at 4:31

Cannot install using Python 3.2

What steps will reproduce the problem?
1. Download the package
2. Open terminal
3. Go to the directory where the file is placed and unzip it
4. Run "python setup.py install"

What is the expected output? What do you see instead?
Expected to install, however this is the current output:

daniel@dqo:pydelicious - [ruby-1.9.2 - (master) $ ]$ python setup.py install
Traceback (most recent call last):
  File "setup.py", line 11, in <module>
    import pydelicious
  File "/Users/daniel/Documents/lang/python/pydelicious/pydelicious/__init__.py", line 171
    raise DeliciousItemExistsError, params['url']
                                  ^
SyntaxError: invalid syntax

What version of the product are you using? On what operating system?
Python 3.2.3 (default, Apr 19 2012, 01:32:56) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin

Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 6 Jan 2013 at 3:53

Unicode

How does pydelicious handle unicode?  The characters stored/retrieved are
different!

In [114]: orig=u'LaTeX project: LaTeX \x96 A document preparation system' 

In [117]:
pydelicious.add('...','...','http://www.latex-project.org/',orig,tags='LaTeX',re
place='yes')
Out[117]: {'result': (True, 'done')}

In [119]: xs=pydelicious.get('...','...','LaTeX')['posts']

In [123]: orig==xs[0]['description']
Out[123]: False

In [125]: back=xs[0]['description']

In [126]: back
Out[126]: u'LaTeX project: LaTeX \u2013 A document preparation system'

In [127]: orig.encode('utf-8')
Out[127]: 'LaTeX project: LaTeX \xc2\x96 A document preparation system'

In [128]: back.encode('utf-8')
Out[128]: 'LaTeX project: LaTeX \xe2\x80\x93 A document preparation system'

In [129]: Out[127]==Out[128]
Out[129]: False

Original issue reported on code.google.com by [email protected] on 30 Apr 2008 at 5:37

Project ownership

Greg, L.S.,

Since i cannot reach the project owner directly i will propose here to take
over project maintenance.

Greg, I read somewhere that two years ago you did not want to take the code
but where forced to because the project initiator did not respond to email.
I have found the project here at Google code and have since given it my
share of love and care I hate to see that happen to this home.

I do not need nor want drastic changes, but do want to keep up an active
role here. There are enough good ideas and functionality still to be added. 

In the near future I intent to go futher on integrating the del.icio.us
feeds and extend dlcs (within or without this project). Among others, one
of the first this i want is to try to settle on one or more free-software
licenses for the codebase.

Please let me know your thoughts. Dropping me a line by email would be most
appreciated.


With warm regards, Berend

Original issue reported on code.google.com by [email protected] on 11 Dec 2008 at 10:55

Proxy settings are only set for http, not https

Due to the nature of the v1 version of the del.icio.us API (which uses https), 
you also need to set the https proxy, not only the http proxy when accessing 
the API.
My patch is attached; it will use the HTTP_PROXY environment variable and also 
set it for the https configuration.

Original issue reported on code.google.com by [email protected] on 29 Jul 2010 at 11:13

Attachments:

md5 module is deprecated

Upon import:

/site-packages/pydelicious-0.5.2_rc2-py2.6.egg/pydelicious/__init__.py:27:
DeprecationWarning: the md5 module is deprecated; use hashlib instead


This is using Python 2.6.2 on Ubuntu 9.04.

Original issue reported on code.google.com by [email protected] on 10 May 2009 at 10:24

Patch for more efficient authentication and a bit of error handling

By default pydelicious issues two http requests per API call. The first
call fails with the server sending back "401 Unauthorized", then urllib2
sends the request a second time with the authentication credentials. The
extra calls are inefficient. They also seem to trigger some rate limiting
in the delicious API servers that caused my program to break.

Below is a patch to just send all requests to Delicious with the
credentials in the Authorization: header even before Delicious gets around
to asking for it. I've verified this results in the first request working,
and my previously-throttled scripts are now working better.

As a bonus there's a second patch changing the error handling a bit.
Instead of returning 'False' on all errors, now it tries to return an error
string. pydelicious should be reworked to throw exceptions, but I'm too
lazy to do that now.

Index: pydelicious.py
===================================================================
--- pydelicious.py      (revision 2)
+++ pydelicious.py      (working copy)
@@ -51,7 +51,7 @@
 #  * rss parser muss auf viele möglichkeiten angepasst werden           


-import re, md5, httplib
+import re, md5, httplib, base64
 import urllib, urllib2, time
 # import datetime, 
 import StringIO
@@ -318,6 +318,11 @@
     request = urllib2.Request(DWS_API + url + params)
     if useUrlAsIs: request = urllib2.Request(url)
     request.add_header('User-Agent', USER_AGENT)
+
+    # Always send the authentication credentials; avoid an extra round
trip with 401
+    credentials = base64.encodestring("%s:%s" % (user, passwd))
+    request.add_header('Authorization', ('Basic %s' % credentials))
+
     if DEBUG: print "url:", request.get_full_url()
     try:
         o = urllib2.urlopen(request)            
@@ -340,7 +345,10 @@
         if (x.getroot().attrib.has_key("code") and
x.getroot().attrib["code"] == 'done') or x.getroot().text in ['done', 'ok']:
             l = True
         else :
-            l = False
+            if x.getroot().attrib.has_key("code"):
+                l = x.getroot().attrib["code"]
+            else:
+                l = False
     elif mode == 'update':
         l = x.getroot().attrib['time']
     elif mode == 'dates':

Original issue reported on code.google.com by [email protected] on 15 Feb 2007 at 7:13

I get 404 not found erros.

I've tryied everything but can't make some methods work.

What steps will reproduce the problem?
1. import pydelicious
2. pydelicious.get_userposts('myusr')
3. pydelicious.PyDeliciousException: HTTP Error 404: Not Found

What is the expected output? What do you see instead?

I expect getting posts (get_popular works fine) but i get this exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.6/dist-packages/pydelicious-0.6-py2.6.egg/pydelicious/__init__.py", line 973, in get_userposts
    return getrss(user=user)
  File "/usr/local/lib/python2.6/dist-packages/pydelicious-0.6-py2.6.egg/pydelicious/__init__.py", line 969, in getrss
    return dlcs_rss_request(tag=tag, popular=popular, user=user, url=url)
  File "/usr/local/lib/python2.6/dist-packages/pydelicious-0.6-py2.6.egg/pydelicious/__init__.py", line 447, in dlcs_rss_request
    rss = http_request(url).read()
  File "/usr/local/lib/python2.6/dist-packages/pydelicious-0.6-py2.6.egg/pydelicious/__init__.py", line 227, in http_request
    raise PyDeliciousException, "%s" % e
pydelicious.PyDeliciousException: HTTP Error 404: Not Found

Original issue reported on code.google.com by [email protected] on 19 Aug 2011 at 12:33

How do you install it?

What steps will reproduce the problem?
1. Download v0.6
2. Unizip
3. Run cmd
4. cd to unzipped folder
4. python setup.py install

What is the expected output? What do you see instead?
Expected to install. I get
  Traceback (most recent call last):
  File "setup.py", line 11, in ?
    import pydelicious
  File "C:\Documents and Settings\George\Desktop\Downloads\pydelicious-0.6\pydelicious\__init__.py", line 41, in ?
    from xml.etree.ElementTree import parse as parse_xml
ImportError: No module named etree.ElementTree

What version of the product are you using? On what operating system?
pydelicious0.6, Python 2.4.4, Windows XP SP3.
Python works fine.

Please provide any additional information below.
What version of Python does this work with???
Where is the documentation??? There is none on this site and the doc folder is 
empty.

Original issue reported on code.google.com by [email protected] on 26 Nov 2011 at 4:22

Add support for proxy

What steps will reproduce the problem?
1. Test api on a system connected to internet through a proxy

What is the expected output? What do you see instead?


this error happens :
<urlopen error [Errno 10060] A connection attempt failed because the 
connected party did not properly respond after a period of time, or 
established connection failed because connected host has failed to 
respond>, 4 tries left.
<urlopen error [Errno 10060] A connection attempt failed because the 
connected party did not properly respond after a period of time, or 
established connection failed because connected host has failed to 
respond>, 3 tries left.
<urlopen error [Errno 10060] A connection attempt failed because the 
connected party did not properly respond after a period of time, or 
established connection failed because connected host has failed to 
respond>, 2 tries left.
<urlopen error [Errno 10060] A connection attempt failed because the 
connected party did not properly respond after a period of time, or 
established connection failed because connected host has failed to 
respond>, 1 tries left.
Traceback (most recent call last):
  File "play.py", line 49, in <module>
    pydelicious.get_popular(tag='programming')
  File "C:\Python26\lib\site-packages\pydelicious.py", line 929, in 
get_popular
    return getrss(tag=tag, popular=1)
  File "C:\Python26\lib\site-packages\pydelicious.py", line 913, in getrss
    return dlcs_rss_request(tag=tag, popular=popular, user=user, url=url)
  File "C:\Python26\lib\site-packages\pydelicious.py", line 414, in 
dlcs_rss_request
    rss = http_request(url).read()
  File "C:\Python26\lib\site-packages\pydelicious.py", line 225, in 
http_request
    "Unable to retrieve data at '%s', %s" % (url, e)



What version of the product are you using? On what operating system?
pydelicious-0.5.2-rc1.zip

Please provide any additional information below.

in my system , which connects to the internet via a proxy , this code works


proxy_support = urllib2.ProxyHandler({'http': 
'http://168.219.61.250:8080/'})
opener = urllib2.build_opener(proxy_support)
urllib2.install_opener(opener)
response = urllib2.urlopen('http://python.org/')
html = response.read()
print html

Original issue reported on code.google.com by [email protected] on 20 Jul 2009 at 8:52

borked dev version in main branch

What steps will reproduce the problem?
1. try to install package using standard install
2. install by hand and then call get_popular
3.

What is the expected output? What do you see instead?
working code versus error messages

What version of the product are you using? On what operating system?
5 main branch on linux

Please provide any additional information below.
The dlcs_rss_request method is commented out when other code depends on it.
The installer has an intentional error raise with a debug switch on it.

Not trying to be a smartass, but you might want to consider putting some
branches in the svn for development work. Or, at the very least, if there
are previous versions of the code that work, put them here.

Original issue reported on code.google.com by [email protected] on 18 Sep 2007 at 10:41

Should not re-encode unicode data

What steps will reproduce the problem?
1. Create a unicode string (e.g. for description)
2. Convert the unicode object to str with django's smart_str utility
3. Call posts_add

What is the expected output? What do you see instead?

Expected: successful posting to delicious.

Instead: UnicodeDecodeError as pydelicious tries to encode the, already UTF-8 
string into UTF-8

What version of the product are you using? On what operating system?

0.5.0 on Apple Snow Leopard

Please provide any additional information below.

Recreating with just the django shell command line:

>>> title = u'Carniv\xe0le'
>>> print title.encode('utf-8')
Carnivàle
>>> print smart_str(title)
Carnivàle
>>> print smart_str(title).encode('utf-8') # how pydelicious currently tries to 
handle the data
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 6: ordinal 
not in range(128)

Fix:

Attached, but I just added a new class variable: "encoded" which defaults to 
False. If calling users sets to "True" then the encoding step is skipped. It'd 
probably be more ideal to somehow check the encoding state of the data.

diffed:
def __init__(self, user, passwd, codec='iso-8859-1', 
api_request=dlcs_api_request, xml_parser=dlcs_parse_xml, encoded=False):
…
self.encoded = encoded
…
if not self.encoded:
    for key in params:
        params[key] = params[key].encode(self.codec)

Original issue reported on code.google.com by [email protected] on 27 Jun 2010 at 1:21

Attachments:

Main API class patch + some refactoring

I guess this is as good a place as any to discuss:

some major rewriting of the API class. Encoding seems to work here (UTF-8).
I've been using/editing it for a while now so I'm not sure what exactly has
changed compared to the old DeliciousAPI class. What did change is that all
api functions now parse the result XML to a dicts-n-lists (JSON like
structure) or (optionally) just return the file-handle (wrapped in
urllib.addinfourl) to parse the response yourself. The 'convenience'
methods on the module (apiNew(), etc) should still work alike, but the
return value may be changed.

Didn't touch RSS and JSON api stuff (yet?), in fact I commented some RSS
code out since it didn't seem to be working? Also changed source code to
ASCII, etc. etc. Still work to be done.

Is there any interest here in my work? I've also written a simple
command-line utility to work with the bookmark collection from terminal;
rename tags, bundle, find posts, print as JSON, etc. I use it a lot. Handy
for import/export, batches, etc.

I'll attach the diff (pydelicious.py only) between de SVN checkout and my
local code. Not sure how I can check this in but if there's any interest
I'm sure this can be figured out.

Original issue reported on code.google.com by [email protected] on 25 May 2007 at 2:28

Attachments:

New delicious post-Avos breaks pydelicious?

What steps will reproduce the problem?
1. clean Amazon instance with Python 2.6.6
2. sudo easy_install pydelicious
3. dlcs -u <username>

What is the expected output? What do you see instead?
Errors as:

Save password to config (/home/ramana/.dlcs-rc)? [Y]es/No: n
Traceback (most recent call last):
  File "/usr/bin/dlcs", line 9, in <module>
    load_entry_point('pydelicious==0.6', 'console_scripts', 'dlcs')()
  File "/usr/lib/python2.6/site-packages/pydelicious-0.6-py2.6.egg/pydelicious/tools/dlcs.py", line 1196, in _main
    sys.exit(main(sys.argv[1:]))
  File "/usr/lib/python2.6/site-packages/pydelicious-0.6-py2.6.egg/pydelicious/tools/dlcs.py", line 427, in main
    return cmd(conf, dlcs, *args, **options)
  File "/usr/lib/python2.6/site-packages/pydelicious-0.6-py2.6.egg/pydelicious/tools/dlcs.py", line 471, in info
    u = dlcs.posts_update()['update']['time']
  File "/usr/lib/python2.6/site-packages/pydelicious-0.6-py2.6.egg/pydelicious/__init__.py", line 785, in posts_update
    return self.request("posts/update", **kwds)
  File "/usr/lib/python2.6/site-packages/pydelicious-0.6-py2.6.egg/pydelicious/__init__.py", line 718, in request
    fl = self._api_request(path, params=params, opener=self._opener)
  File "/usr/lib/python2.6/site-packages/pydelicious-0.6-py2.6.egg/pydelicious/__init__.py", line 304, in dlcs_api_request
    fl = http_request(url, opener=opener)
  File "/usr/lib/python2.6/site-packages/pydelicious-0.6-py2.6.egg/pydelicious/__init__.py", line 224, in http_request
    return opener.open(request)
  File "/usr/lib/python2.6/urllib2.py", line 397, in open
    response = meth(req, response)
  File "/usr/lib/python2.6/urllib2.py", line 510, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.6/urllib2.py", line 429, in error
    result = self._call_chain(*args)
  File "/usr/lib/python2.6/urllib2.py", line 369, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.6/site-packages/pydelicious-0.6-py2.6.egg/pydelicious/__init__.py", line 183, in http_error_401
    raise PyDeliciousUnauthorized, "Check credentials."
pydelicious.PyDeliciousUnauthorized: Check credentials.

What version of the product are you using? On what operating system?
0.6, Python 2.6.6, CentOS 5.x

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 29 Sep 2011 at 12:38

Download pydelicious

There should be a downloadable version of pydelicious. A simple .tar.gz
pacakge will do.

Original issue reported on code.google.com by [email protected] on 5 Oct 2007 at 3:31

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.