def test_bug_missing_http_request_showData(self): if user == '': return '' a = p.apiNew(user, passwd) r = a.posts_add("http://11833/", "D", "aws", "sla") r2 = a.posts_delete("http://11833/") if r.bozo: print r.bozo_exception return "" self.assert_(r.http_request.showData() != '') self.assert_(r.http_request.showData() != '')
def main(duser, dpass, filename): with open(filename) as f: starred = json.load(f) print "importing", len(starred['items'][SLICE]), "items" for i, item in enumerate(starred['items'][SLICE]): kwargs = prepare_item(item) api = pydelicious.apiNew(duser, dpass) try: api.posts_add(**kwargs) except pydelicious.DeliciousItemExistsError: print "Item", i, "already exists:", kwargs['description'] pprint.pprint(kwargs) except Exception, e: print "item ", i, "failed" pprint.pprint(kwargs) print e time.sleep(SLEEP_INTERVAL)
#!/usr/bin/env python """ ch03_pydelicious_example.py - An example using pydelicious """ DEL_USER = '******' DEL_PASSWD = 'yourpassword' import pydelicious api = pydelicious.apiNew(DEL_USER, DEL_PASSWD) print "Posting bookmark." api.posts_add(url='http://decafbad.com', description='0xDECAFBAD', extended="Friends don't let friends drink decaf.", tags='programming coffee caffeine') print "Deleting bookmark." api.posts_delete('http://decafbad.com') print "Recent posts:" for post in api.posts_recent(): print "\t%(description)s" % post print "Top 10 tags:" def tag_order(a, b): return cmp(int(b['count']), int(a['count']))
def __init__(self,user=defaultuser,passwd=defaultpasswd): self.connection=pydelicious.apiNew(user,passwd)
def setUp(self): self.a = p.apiNew(user, passwd)
#!/usr/bin/python import pydelicious # delicious website keeps throw 503 now (2017.02) # cannot login, and no idea about useable api list a = pydelicious.apiNew('user', 'passwd') a.tags_get() # Same as: a.request('tags/get', )
#!/usr/bin/python # -*- coding: utf-8 -*- """Delicious Link logger which submits links to del.icio.us.""" import pydelicious, re api = pydelicious.apiNew('NICKNAME', 'PASSWORD') link_re = re.compile('^(.*\s)?(http://.+?)(\s.*)?$') def addlink(bot, event): matches = link_re.findall(event.message) if (matches): matches = matches[0] url = matches[1] title = (matches[0] + matches[2]).trim() or url description = "<%s> %s" % (event.sender, event.message) tags = (event.sender, event.channel) api.posts_add(url=url, description=title, extended=description, tags=" ".join(tags)) print "___ Posted '%s' to http://del.icio.us/%s" % (url, api.user) rules = {addlink: 'msg'}