Beispiel #1
0
def create(display_name, description, primary_language, private):
    project = Project()
    project.display_name = display_name
    project.description = description
    project.primary_language = primary_language
    project.private = private
    project.save()
    echo_project(project)
def createZooniverseProject(projName, projDesc, primLang, flag_hidden):

    print('--- --- --- ---')
    print('Establishing connection to Zooniverse and creating project')

    notSaved = True
    saveCheck = 0
    project = None
    connected = False

    while not connected:
        url = 'http://zooniverse.org/'
        print('Attempting connection.')
        try:
            response = requests.get(url, timeout=0.2)
        except ConnectionError as ce:
            print(ce)
        except HTTPError as he:
            print(he)
        except Timeout as to:
            print(to)
        else:
            print(response)
            connected = True

    while (notSaved and (saveCheck < 5)):
        notSaved = False
        #Make a new project
        project = Project()

        #Project name
        #tutorial_project.display_name = ('{}_test'.format(now))
        project.display_name = projName
        saveCheck += 1

        #Project description
        project.description = projDesc

        #Project language
        project.primary_language = primLang

        #Project visibility
        project.private = flag_hidden

        try:
            project.save()
        except PanoptesAPIException as e:
            print('!!! {} , Waiting 10 seconds...'.format(e))
            notSaved = True
            for i in range(0, 10):
                print('... Waiting {}...'.format(i))
                time.sleep(3)
            project.delete()
            saveCheck += 1

    print('Project successfully created.')

    return project
Beispiel #3
0
def create(display_name, description, primary_language, public, quiet):
    """
    Creates a new project.

    Prints the project ID and name of the new project.
    """

    project = Project()
    project.display_name = display_name
    project.description = description
    project.primary_language = primary_language
    project.private = not public
    project.save()

    if quiet:
        click.echo(project.id)
    else:
        echo_project(project)
# ask user for login and object they want to classify
thing = raw_input("What would you like to classify? ")
user = raw_input("Zooniverse username: "******"password: "******"lxml")

image_type = thing
query = str(thing)
query= query.split()
query='+'.join(query)
url=url="https://www.google.co.in/search?q="+query+"&source=lnms&tbm=isch"
header = {'User-Agent': 'Mozilla/5.0'}
soup = get_soup(url,header)