Sun, 14 Dec 2008
>>> from fedora.client import Wiki
I created a simple Python API for interacting with Fedora's MediaWiki a while back, in an attempt to gather various metrics. I just went ahead and committed it to the python-fedora modules. Here is how to use it:
>>> from fedora.client import Wiki
>>> wiki = Wiki()
>>> wiki.print_recent_changes()
From 2008-12-07 20:59:01.187363 to 2008-12-14 20:59:01.187363
500 wiki changes in the past week
== Most active wiki users ==
Bbbush............................................ 230
Konradm........................................... 25
Duffy............................................. 22
Jreznik........................................... 21
Ianweller......................................... 14
Jjmcd............................................. 14
Geroldka.......................................... 10
Gdk............................................... 9
Anouar............................................ 7
Gomix............................................. 6
== Most edited pages ==
Features/KDE42.................................... 21
SIGs/SciTech/SAGE................................. 15
FUDCon/FUDConF11.................................. 14
Special:Log/upload................................ 13
How to be a release notes beat writer............. 12
Special:Log/move.................................. 11
Design/SETroubleshootUsabilityImprovements........ 10
PackageMaintainers/FEver.......................... 9
User:Gomix........................................ 6
Zh/主要配置文件..................................... 5
>>> for event in wiki.send_request('api.php', req_params={
... 'action': 'query',
... 'list': 'logevents',
... 'format': 'json',
... })['query']['logevents']:
... print '%-10s %-15s %s' % (event['action'], event['user'], event['title'])
...
patrol Ianweller User:Ianweller/How to create a contributor business card
move Nippur REvanderLuit
patrol Ianweller Project Leader
move Ianweller FPL
upload Anouar Image:AnouarAbtoy.JPG
move Liangsuilong ZH/Docs/FetionOnFedora
move Liangsuilong FetionOnFedora
patrol Ianweller User:Ianweller
It uses the fedora.client.BaseClient, which is a class that simplifies interacting with arbitrary web services. Toshio and I created it a while back as a the core client for talking with our various TurboGears-based Fedora Services (bodhi, pkgdb, fas, etc.), but it has now seemed to morph into a much more flexible client for talking JSON with web applications.
from datetime import datetime, timedelta
from collections import defaultdict
from fedora.client import BaseClient
class Wiki(BaseClient):
def __init__(self, base_url='http://fedoraproject.org/w/', *args, **kwargs):
super(Wiki, self).__init__(base_url, *args, **kwargs)
def get_recent_changes(self, now, then, limit=500):
""" Get recent wiki changes from `now` until `then` """
data = self.send_request('api.php', req_params={
'list' : 'recentchanges',
'action' : 'query',
'format' : 'json',
'rcprop' : 'user|title',
'rcend' : then.isoformat().split('.')[0] + 'Z',
'rclimit' : limit,
})
if 'error' in data:
raise Exception(data['error']['info'])
return data['query']['recentchanges']
def print_recent_changes(self, days=7, show=10):
now = datetime.utcnow()
then = now - timedelta(days=days)
print "From %s to %s" % (then, now)
changes = self.get_recent_changes(now=now, then=then)
num_changes = len(changes)
print "%d wiki changes in the past week" % num_changes
users = defaultdict(list) # {username: [change,]}
pages = defaultdict(int) # {pagename: # of edits}
for change in changes:
users[change['user']].append(change['title'])
pages[change['title']] += 1
print '\n== Most active wiki users =='
for user, changes in sorted(users.items(),
cmp=lambda x, y: cmp(len(x[1]), len(y[1])),
reverse=True)[:show]:
print ' %-50s %d' % (('%s' % user).ljust(50, '.'), len(changes))
print '\n== Most edited pages =='
for page, num in sorted(pages.items(),
cmp=lambda x, y: cmp(x[1], y[1]),
reverse=True)[:show]:
print ' %-50s %d' % (('%s' % page).ljust(50, '.'), num)
I added a Wiki.login method to the latest version, but it isn't quite working yet. This is due to some minor limitations in the ProxyClient, so we currently cannot handle authenticated requests. However, this shouldn't be very difficult to implement. The reason for this is that we need to be able to run authenticated queries as a 'bot' account in order to mitigate the 500 entry API return limit.
This module makes it easy to talk to MediaWiki's API, so if you do anything cool with it feel free to send patches here. It's currently not being shipped in a python-fedora release, so you'll have to grab the code from Bazaar:
bzr branch bzr://bzr.fedorahosted.org/bzr/python-fedora/python-fedora-devel
posted at: 18:12 | link | | 11 comments
Posted by Kicaromia at Thu Aug 27 18:30:15 2009
Bill Bartmann, Author of “Bailout Riches!” tells How to Make a Fortune Buying Bad Loans
Learn how America’s financial crisis becomes an investment opportunity to buy outstanding debts for pennies on the dollar
Tulsa, OK – How does America’s financial crisis become an investment opportunity? Bill Bartmann, author of the book, Bailout Riches!, explains, “It begins with over $1 trillion dollars in defaulted mortgages, credit card debt and other bad loans being written off and sold to investors for pennies on the dollar.”
Bill Bartmann’s book provides investors with the right roadmap to spectacular profits with a step by step plan to find deals from the federal government, local financial institutions and loan brokers. The defaulted loans include credit card debt, consumer loans, business loans, commercial loans and real estate loans and mortgages. “It gets better,” said Bartmann. “The book provides a proven system for buying debt without using your own money.”
Bailout Riches! shows how to invest in the bailout and take your own cut of the trillion dollar pie. Bill Bartmann is an authority on the subject; during the last big-time government bailout Bartmann built his own debt collection company and became a billionaire. “Today’s bailout is much bigger and opportunities for profit are much greater,” said Bartmann.
When asked why he would share this valuable information with the world, Bill Bartmann answered, “The reason is simple; there’s plenty to go around. In the next year or two around $1 trillion of debt will be written down and sold cheap.”
Bill Bartmann is the author of Bailout Riches! and the creator of America’s largest debt-buying and debt-collection company. Bill Bartmann has been listed among Forbes Magazine’s 400 wealthiest Americans and has twice been named National Entrepreneur of the Year by USA Today, NASDAQ, Inc Magazine, Ernst & Young and the Kauffman Foundation. Visit http://www.roadtomajorwealth.com
Posted by jeredfpkurt at Sun May 9 03:20:48 2010
lyman sc dating dating last minute invite dating pros thompson station aquarius dating bhm chino court construction date trinidad dating sex dating in brooklyn kentucky
3datingTorontoViA2
Posted by lesyPoode at Thu Jun 17 14:12:54 2010
новая фишка
диета заинтересует девушек
http://webmaster.audio-krasota.ru/ - Диета четырех дней
<a href=http://webmaster.audio-krasota.ru>Сладкоежек диета
</a>
Posted by Kbljucgs at Wed Dec 15 19:07:28 2010
It is done to achieve the aim of enlightenment or moksha. , www.sovereign-general.com, [url="http://bv0.generalready.com/www.sovereign-general.com.html"]www.sovereign-general.com[/url], http://bv0.generalready.com/www.sovereign-general.com.html www.sovereign-general.com, ugsihw,
Posted by Gtbhlaxh at Sun Dec 19 18:38:51 2010
The major concerns of the Council involved constricting the conduct of church members. , www.xnxxxtgp.com, [url="http://rocugisu.t35.com/www.xnxxxtgp.com.html"]www.xnxxxtgp.com[/url], http://rocugisu.t35.com/www.xnxxxtgp.com.html www.xnxxxtgp.com, stna,
Posted by warezni00 at Tue Jan 25 22:48:31 2011
<a href=http://warezni4ek.su/>warezni4ek.su</a>-Развлекательный варез портал, У нас Вы сможете скачать альбомы музыки, так же скачать бесплатно фильмы, посмотреть и скачать картинки, всегда быть вкурсе выхода новых программ и скачать бесплатно программу.Entertaining warez portal Here you can download music albums, just free movies, watch and download pictures to be always vkurse out new programs and free software.
Posted by americanfilmÐ at Wed Feb 16 07:27:59 2011
Ó ìíîãèõ èìåþòñÿ ñòåðåîòèïû íà ñ÷åò àìåðèêàíñêèõ ôèëüìîâ, ÿêîáû àìåðèêàíöû òóïûå è òîëêîì íå óìåþò íè÷åãî äåëàòü.Äàâàéòå âçãëÿíåì ïðàâäå â ãëàçà, àìåðèêàíñêèé êèíåìàòîãðàô êðóïíåéøèé â ìèðå, ñîçäàâøèé âåëè÷àéøèå ôèëüìû, èíòåðåñíåéøèå ñåðèàëû, êîòîðûå áåñïîùàäíî êîïèðóþò è ïåðåñíèìàþò ó íàñ. Äà ó àìåðèêàíöåâ ìíîãî òðýøà â êèíî, íî íå ñòîèò áåç ðàçáîðó îòìåòàòü ñðàçó âñå ôèëüìû. Äàáû ðàçóáåäèòü Âàñ ïðåäëîæó <a href=http://americanfilms.ru/>ñàéò</a> ñ àìåðèêàíñêèìè ôèëüìàìè. À êàêîå ó Âàñ ìíåíèå íà ýòîò âîïðîñ?
Posted by mxhackru at Tue Apr 12 22:24:32 2011
Íàâåðíîå êàæäûé èç íàñ â æèçíè õî÷åò çàãëÿíóòü â ïî÷òîâûé ÿùèê ñâîåé ïîäðóãè, äðóãà, ïàðòíåðà, êîíêóðåíòà è ò.ä. Êòî-òî õî÷åò ïðîñòî ïîñìîòðåòü ïåðåïèñêó, êòî-òî æåëàåò ïðîâåðèòü èíôîðìàöèþ è ïîëó÷èòü îòâåò íà ñâîé âîïðîñ. Íàøà êîìàíäà ïîìîæåò îêàçàòü âàì ïîìîùü â äàííîé ñèòóàöèè. Ýëåêòðîííàÿ ïî÷òà áóäåò âçëîìàíà àíîíèìíî, âëàäåëåö ïî÷òû äàæå íå ïîéìåò, ÷òî åãî âçëîìàëè. Âçëîì ïî÷òû äëèòüñÿ äî 5-òè äíåé, íî íå èñêëþ÷åíî, ÷òî áóäåò è ðàíüøå. Ìû íèêîãäà íå áåðåì ïðåäîïëàòó!<a href=http://mxhack.ru/>mxhack.ru</a>
Posted by xrumdbru9 at Thu Apr 28 21:24:08 2011
xrumer,áàçû äëÿ õðóìåð,áàçû äëÿ xrumer,áàçû ôîðóìîâ,áàçû êàòàëîãîâ,áàçà áëîãîâ,áàçà äëå,áàçà dle,áàçà ãîñòåâûõ êíèã,áàçà äîñîê îáúÿâëåíèé,òåìàòè÷åñêèå áàçû,çàïàäíûå ðóññêèå áàçû ôîðóìîâ,ñåðâèñ áàç äëÿ õðóìåðà,ñåðâèñ õðóìåð,õðóìåð ñåðâèñ,ñêà÷àòü xrumer,xrumer cracked,xrumer áåñïëàòíî,xrumer ñêà÷àòü áåñïëàòíî,xrumer ,áàçû xrumer,xrumer ,ñêà÷àòü xrumer crack,xrumer palladium,xrumer elite,xrumer ,xrumer ñêà÷àòü áåñïëàòíî cracked,ñêà÷àòü xrumer ,ñêà÷àòü xrumer elite,xrumer palladium,xrumer ,ñêà÷àòü xrumer áåñïëàòíî,xrumer elite ñêà÷àòü áåñïëàòíî,xrumer crack,xrumer elite crack,xrumer ,ôîðóì xrumer,xrumer ðàáî÷èé,xrumer ,ñêà÷àòü xrumer ,xrumer ñêà÷àòü,xrumer ,ñêà÷àòü áàçû xrumer,xrumer ,xrumer áàçà ôîðóìîâ,xrumer elite,xrumer crack,xrumer ,ñêà÷àòü xrumer ,xrumer ñêà÷àòü,xrumer òîððåíò,xrumer key,xrumer ,xrumer torrent,xrumer palladium,xrumer palladium êëþ÷,xrumers ru,xrumer crack,ïðîãðàììà xrumer,xrumer palladium ñêà÷àòü,ñêà÷àòü xrumer áåñïëàòíî,ñêà÷àòü áåñïëàòíî xrumer ,âçëîìàííûé xrumer,xrumer crack,xrumer êðÿê,xrumer elite crack, <a href=http://xrumdb.ru/>Ñåðâèñ áàç äëÿ XRumer</a>
Posted by RockFan7 at Fri May 6 11:50:22 2011
Çäðàâñòâóéòå óâàæàåìûå ÷èòàòåëè. Õî÷ó ïðåäñòàâèòü âàì ñàéò TalkART.ru - ôîðóì î âåá-äèçàéíå. Íà ñàéòå âû ìîæåòå íàéòè î÷åíü ìíîãî õîðîøèõ è èíòåðåñòíûõ ñòàòåé è ìàòåðèàëîâ ïî íåñêîëüêèì êàòåãîðèÿì: ñîçäàíèå ñàéòîâ, è ñîçäàíèå ãðàôèêè íà ïîïóëÿðíûõ ãðàôè÷åñêèõ ðåäàêòîðàõ. Òàêæå ó íàñ ñêîðî áóäåò VIP ðàçäåë, ñ òîëüêî óíèêàëüíûì êîíòåíòîì äëÿ IPB à òàêæå DLE. Çàõîäèòå, áóäåì âñåì ðàäû! <a href=http://talkart.ru>talkart.ru</a>







