def __init__(self, wip_id, auth_key): #super(Behance, self).__init__(auth_key) Behance.__init__(self, auth_key) self.wip_id = wip_id self.base_url = url_join(ENDPOINTS['api'], ENDPOINTS['wip']) self._get_wip_details()
def project_search(self, *args, **kwargs): """Search for projects on Behance. Takes any number of text search terms, as well as key/value filters. Valid filters: [valid values] sort: [featured_date, appreciations, views, comments, published_date] time: [all, today, week, month] field: [URL-encoded field name from Behance list of defined creative fields] country: [2-letter FIPS country code] state: [State or province name] page: [page number of results, 1-indexed] tags: [single tag name or pipe separated list of tags] """ if len(args) == 0: #Make sure user provides search terms... return None else: #Build the URL _base_url = url_join(ENDPOINTS['api'], ENDPOINTS['project']) _terms = "+".join(urllib.parse.quote(arg) for arg in args) _filters = urllib.parse.urlencode(kwargs) _url = '%s?api_key=%s&q=%s&%s' % (_base_url, self.auth_key, _terms, _filters) #Get results from API return [Behance(data=proj) for proj in self._do_api_search(_url)['projects']]
def wip_search(self, *args, **kwargs): if len(args) == 0: return None else: _base_url = url_join(ENDPOINTS['api'], ENDPOINTS['wip']) _terms = "+".join(urllib.parse.quote(arg) for arg in args) _filters = urllib.parse.urlencode(kwargs) _url = '%s?api_key=%s&q=%s&%s' % (_base_url, self.auth_key, _terms, _filters) #Get results from API return [Behance(data=wip) for wip in self._do_api_search(_url)['wips']]
def user_search(self, *args, **kwargs): """Search for users on Behance. Takes any number of text search terms, as well as key/value filters as supported by Behance API.""" if len(args) == 0: return None else: _base_url = url_join(ENDPOINTS['api'], ENDPOINTS['user']) _terms = "+".join(urllib.parse.quote(arg) for arg in args) _filters = urllib.parse.urlencode(kwargs) _url = '%s?api_key=%s&q=%s&%s' % (_base_url, self.auth_key, _terms, _filters) #Get results from API return [Behance(data=user) for user in self._do_api_search(_url)['users']]
def __init__(self, collection_id, auth_key): Behance.__init__(self, auth_key) self.collection_id = collection_id self.base_url = url_join(ENDPOINTS['api'], ENDPOINTS['collection']) self._get_collection_details()
def __init__(self, user_id, auth_key): Behance.__init__(self, auth_key) self.user_id = user_id self.base_url = url_join(ENDPOINTS['api'], ENDPOINTS['user']) self._get_user_details()