Exemple #1
0
def get_projects(url, pattern='*'):
    """ Returns the project names deployed in a Scrapyd instance.
        :param url: The base URL of the Scrapd instance.
        :type url: str
        :param pattern: A globbing pattern that is used to filter the results,
                        defaults to '*'.
        :type pattern: str
        :rtype: A list of strings.
    """
    response = get_request(url + '/listprojects.json')
    return fnmatch.filter(response['projects'], pattern)
Exemple #2
0
def get_spiders(url, project, pattern='*'):
    """ Returns the list of spiders implemented in a project.
        :param url: The base URL of the Scrapd instance.
        :type url: str
        :param project: The name of the project.
        :type project: str
        :param pattern: A globbing pattern that is used to filter the results,
                        defaults to '*'.
        :type pattern: str
        :rtype: A list of strings.
    """
    response = get_request(url + '/listspiders.json',
                           params={'project': project})
    return fnmatch.filter(response['spiders'], pattern)