Skip to content

Repository files navigation

MiniProject2: Discover a list of projects on SourceForge.net and GitLab.com

These two forges present two different types of data discovery challenges.

SourceForge actively prevents discovery. Over ten years ago it was the largest forge but as it started losing market share to other forges, they started blocking project discovery.

GitLab, on the other hand, has an error-prone API that is highly unreliable.

Part 1

  • Discover at least 50 projects on SourceForge and GitLab whose names start with the letter (case insensitive) in front of your name in the list below.
  • Provide the IPython notebook you used to discovery the data.

You are free to use any method, including a list compiled by someone else, search on google search engine, etc. but you do need to verify that the discovered projects currently exist on these forges by retrieving the url of the version control repository used by the project.

Please use the Google Cloud VM when discovering the project names to avoid accidentally causing UTK to be blocked.

LetterGitHub UsernameNetIDName
a3PIVpprovinsProvins IV, Preston
bBrettBass13bbass11Bass, Brett Czech
cCipherR9gyj992Johnson, Rojae Antonio
dColsarcolcmawhinnMawhinney, Colin Joseph
eEvanEzelleezell3Ezell, Evan Collin
fMikeynJerryjdunca51Duncan, Jerry
gTasmiatrahman4Rahman, Tasmia
hawilki13awilki13Wilkinson, Alex Webb
ibryanpacep1jpace7Pace, Jonathan Bryan
jcaiwjohncjohn3John, Cai William
kcflemmoncflemmonFlemmons, Cole
ldbarry9dbarryBarry, Daniel Patrick
mdesai07adesai6Desai, Avie
ngjones1911gjones2Jones, Gerald Leon
oherronejeherron5Herron, Emily Joyce
phossain-rayhanrhossai2Hossain, Rayhan
qjdong6jdong6Dong, Jeffrey Jing
rjyu25utkjyu25Yu, Jinxiao
smkramer6mkramer6Kramer, Matthew S
tmmahbubmmahbubMahbub, Maria
unmansou4nmansou4Mansour, Nasib
vnschwerznschwerzSchwerzler, Nicolas Winfield William
wrdabbs42rdabbs1Dabbs, Rosemary
xsaramsvmousaviMousavicheshmehkaboodi, Sara
yspaulsteinbergssteinb2Steinberg, Samuel Paul
zzol0akarnaucKarnauch, Andrey
azrandallzrandallRandall, Zachary Adams
blpassarellalpassarePassarella, Linsey Sara
ctgoedeckepgoedec1Goedecke, Trish
dray830305hchang13Chang, Hsun Jui
essravalissadhu2Sadhu, Sri Ravali
fdiadoojpovlinPovlin, John P
gmander59mander59Anderson, Matt Mcguffee
hiway1iway1Way, Isaac Caldwell

GitLab discovery

GitLab provides APIs to retrieve project urls.
Here is sample code for collecting project urls (and storing data in mongodb):

import sys
import re
import pymongo
import json
import time
import datetime
import requests
dbname = "fdac18mp2" #please use this database
collname = "glprj_yourutkid" #please modify so you store data in your collection
# beginning page index
begin = "0"
client = pymongo.MongoClient()
db = client[dbname]
coll = db[collname]
beginurl = "https://gitlab.com/api/v4/projects?archived=false&membership=false&order_by=created_at&owned=false&page=" + begin + \
"&per_page=99&simple=false&sort=desc&starred=false&statistics=false&with_custom_attributes=false&with_issues_enabled=false&with_merge_requests_enabled=false"
gleft = 0
header = {'per_page': 99}
# check remaining query chances for rate-limit restriction
def wait(left):
global header
while (left < 20):
l = requests.get('https://gitlab.com/api/v4/projects', headers=header)
if (l.ok):
left = int(l.headers.get('RateLimit-Remaining'))
time .sleep(60)
return left
# send queries and extract urls def get(url, coll):
global gleft
global header
global bginnum
gleft = wait(gleft)
values = []
size = 0
try:
r = requests .get(url, headers=header)
time .sleep(0.5)
# got blocked
if r.status_code == 403:
return "got blocked", str(bginnum)
if (r.ok):
gleft = int(r.headers.get('RateLimit-Remaining'))
lll = r.headers.get('Link')
t = r.text
array = json.loads(t)
for el in array:
coll.insert(el)
#next page
while ('; rel="next"' in lll):
gleft = int(r.headers.get('RateLimit-Remaining'))
gleft = wait(gleft)
# extract next page url
ll = lll.replace(';', ',').split(',')
url = ll[ll.index(' rel="next"') -
1].replace('<', '').replace('>', '').lstrip()
try:
r = requests .get(url, headers=header)
if r.status_code == 403:
return "got blocked", str(bginnum)
if (r.ok):
lll = r.headers.get('Link')
t = r.text
array1 = json.loads(t)
for el in array1:
coll.insert(el)
else:
sys.stderr.write("url can not found:\n" + url + '\n')
return except requests.exceptions.ConnectionError:
sys.stderr.write('could not get ' + url + '\n')
else:
sys.stderr.write("url can not found:\n" + url + '\n')
return
except requests.exceptions.ConnectionError:
sys.stderr.write('could not get ' + url + '\n')
except Exception as e:
sys.stderr.write(url + ';' + str(e) + '\n')
#start retrieving get(beginurl,coll)

Note that the parameters in the sample code are not optimal. Please feel free to tune them. This sample code is not robust enough to deal with various returned errors from query. You might need to investigate errors encountered individually.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages