Closed Bug 758610 Opened 12 years ago Closed 12 years ago

Script to automatically add / remove feeds from planet.mozillareps.org

Categories

(Mozilla Reps Graveyard :: reps.mozilla.org, task)

task
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: giorgos, Assigned: gothu000)

References

Details

(Whiteboard: mentor)

We need a script to read the feeds from ReMo Portal API and automatically add remove them in planet.mozillareps.org
Depends on: 762110
Whiteboard: mentor
I am interested to contribute in this bug. However, I need help on json and API. Is there any links or documentations on that. I got the info regarding this bug while going through link https://wiki.mozilla.org/Webdev/GetInvolved. TQ.
Hi gothu0000,

Great that you want to take over this bug! On remo (reps.mozilla.org) we have an API from where you can pull the required information.

For example you can get all reps using the following URL:

https://reps.mozilla.org/api/v1/rep/?format=json&limit=0

What we need is a script that can get the JSON from the url above and output a file with the following format:

""""
[<FEED_URL>]
name = <REP NAME>
avatar = <REP AVATAR>

<and so on>
""""

You can get all this information from the API.

Note that not all Reps have feeds, so we should include only the reps with feeds.

Drop by #remo-dev on irc.mozilla.org to talk about this live if you want. I'm usually there between 7.00 - 15.00 UTC

Thanks!
Hi Giorgos Logiotatidis,
Thanks for the help, I wanted to know the language for the script can be shell script, python,  php or anyother? Will any recent version for the language work or are only specific versions are supported.
Thanks!
Hi gothu000,

I prefer python, but you can use anything that you like as long as we can run it on our debian server. Any language that can fetch and parse a JSON file will do.
Hi Giorgos Logiotatidis,

I created following code for getting name and feeds using python, I am confused about automatically adding and removing feeds in planet.mozillareps.org, please help me with this part.

Thanks

[code]

import httplib
import json

def estb_conn():
	conn = httplib.HTTPSConnection('reps.mozilla.org')
	conn.request("GET", "/api/v1/rep/?format=json&limit=0")
	response = conn.getresponse()
	if response.status != 200:
		print "Error : ", response.status, response.reason
	else:
		return (conn, response)

def filter_json(data):
	j_data = json.loads(data)
	print len(j_data["objects"])
	for i in range(0, len(j_data["objects"])):
		if j_data["objects"][i]["profile"]["personal_blog_feed"] != "" and j_data["objects"][i]["profile"]["personal_blog_feed"] != " ":
			print j_data["objects"][i]["first_name"], j_data["objects"][i]["profile"]["personal_blog_feed"]

conn, response = estb_conn()
data = response.read()
filter_json(data

conn.close()
Hi,

Great start! Please consider these following steps

1. Create a github repository with you code so we can easier collaborate on this. 
2. Output the results as I suggest in comment #2

When you output the results as in comment #2, I'll take your scripts and run it on our server to automatically update the feed.

You can always ping me on irc if you need to chat about it.

BTW I assign the bug to you, as you already do the coding, you should take the credit ;)

Thanks for contributing! ;)
Giorgos
Assignee: nobody → gothu000
Status: NEW → ASSIGNED
Hi Giorgos Logiotatidis,
github link: https://github.com/SKatiyar/bugsmozilla/tree/master/bug758610
the output is in form of results in comment #2, but i am confused if the feed_url should be between [] or not.
Thanks
Hi gothu000,

I created a new repository for this specific project under my account. You can find it here

http://github.com/glogiotatidis/ReMo-Planet-AutoFeed

Can you please fork this, add your code and pull request so we can discuss your code and move forward?

Thanks!
Hi Giorgos Logiotatidis,
I forked your repo. I wanted to ask how do i upload my code and what should be the name of the folder??
Thanks!
Hi,

Now that you forked my repo, clone it on your machine and copy 

"https://github.com/SKatiyar/bugsmozilla/blob/master/bug758610/bug%20758610.py

Rename the file into something more meaningful, like "planet_config_genator.py" commit and push to your repository. After pushing to your repository, you can pull request to me.

Thanks!
Great job gothu000! This is merged here:

https://github.com/glogiotatidis/ReMo-Planet-AutoFeed

We will wait a few days before deploying it to make sure that all reps use the appropriate 'feed_url' field in their profile.



gothu000,

Maybe you would like to continue with another bug? I suggest this one:

https://bugzilla.mozilla.org/show_bug.cgi?id=758601

but you can pick whichever you like from the list

https://remo.etherpad.mozilla.org/webdev-opportunities?
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Steps to reproduce for testing? Or is this already working on production?
This is already working on production. 

To verify this you can add a valid feed url to your 'feed for mozilla reps planet' field in your profile. Then check planet.mozillareps.org and you should find your feed. Remember to give it a couple of minutes to update first.

Since this is now working on production I'm verifying.
Status: RESOLVED → VERIFIED
Product: Mozilla Reps → Mozilla Reps Graveyard
You need to log in before you can comment on or make changes to this bug.