Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
retoor7664dThis is a micro python tutorial for people new to the language. It's written to show some python features. I hope this helps.
Tabs or spaces doesn't matter guys! If using spaces, it must be a multiple of two.
This code will show every comment where Lensflare is doing a mention to someone:
Challenge: do filter mentions using the get_comments parameters. Use your imagination. -
retoor7664d@ScriptCoded fack, yeah was too fast. The first example image even has a syntax error.
But besides that, I kinda like my examples, it's quite a microtutorial :) With this info, you can query and display yourself as someone not knowing python I guess :) -
D-4got10-0124011h@retoor: Holy fuck.
This has worked very nicely on 1st try.
_Awesome_ tutorial.
/* I finally got around installing python && trying this out. */
Related Rants
Some people wanted to download their rants / comments. I'm working on it.
Three lines of native python code (no dependencies) to see what @Lensflare said:
from pprint import pp
from xmlrpc.client import ServerProxy
pp(ServerProxy("https://victoria.molodetz.nl/rpc").get_comments({'id':{'gt':42},'_limit':1337,'username':'Lensflare'}))
I think this gives example of possibilities enough. Use your fantasy on how to retrieve rants.
Limitations:
- Not whole dR is available yet, but way more than retrievable using the public dR API. This system uses the user website as source.
- It doesn't show rant_id or comment_id and it won't to prevent abuse. Later today, there will be away to attach rants comments.
- maximum 2500 record limit. But soon you can get comments for every rant per user. You won't reach this limit in normal usage
Have fun with it! Don't worry about the abusing the API. Everything is allowed. It's fast as F. If it doesn't respond - it wasn't you. I work on it and often reboot services and it takes some time to recover to state.
If you're not familiar with python, that's ok. Check if you're a decent dev and have python or python3 on your computer. Just execute it and paste the lines. Other way is to save these three limes to a file ending with .py and execute python3 [your-file].
Another example for people not used to python:
from pprint import pprint as pp # nice printing of values
client = ServerProxy("https://victoria.molodetz.nl/rpc")
comments = client.get_comments({'_limit':1337})
for comment in comments:
if comment.get('username','default username') == 'kiki':
print(comment.get('body'))
pp(comment)
Happy hacking!
random
accounts
rpc
users
api
rants
devrant
xmlrpc4life
comments
no rest