def is_south_america_ip(editinfo):
  if not user_is_ip_address(editinfo):
    return 0
  username = editinfo['user']
  if get_continent(username) == 'SA':
    return 1
  return 0
def is_australia_ip(editinfo):
    if not user_is_ip_address(editinfo):
        return 0
    username = editinfo["user"]
    if get_continent(username) == "OC":
        return 1
    return 0
def user_num_groups(editinfo):
    if user_is_ip_address(editinfo):
        return 0
    username = editinfo['user']
    query = 'http://en.wikipedia.org/w/api.php?action=query&list=users&ususers=' + username + '&format=json&usprop=blockinfo|groups|editcount|registration|emailable|gender'
    try:
        jsonobj = make_wikipedia_request_json(query)
        data = jsonobj[u'query'][u'users'][0]
        group_num = len(data[u'groups'])
        return group_num
    except:
        return 0
Beispiel #4
0
def is_europe_ip(editinfo):
  if not user_is_ip_address(editinfo):
    return 0
  username = editinfo['user']
  return int(ip_is_europe(username))
def is_north_america_ip(editinfo):
  if not user_is_ip_address(editinfo):
    return 0
  username = editinfo['user']
  return int(ip_is_north_america(username))