This repository was archived by the owner on Jun 11, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,6 +48,17 @@ Example Usage:
4848 profiles[0 ].update()
4949
5050
51+ # working with search
52+ s = atomx.search(' mini*' )
53+ # s is now a dict with lists of search results for the different models
54+ # with the model id and name
55+
56+ publisher = s[' publisher' ][0 ] # get the first publisher..
57+ publisher.reload() # .. and load all the data
58+ print (publisher) # now all publisher data is there
59+
60+
61+
5162 Installation
5263------------
5364
Original file line number Diff line number Diff line change @@ -48,7 +48,14 @@ def search(self, query):
4848 r = self .session .get (self .api_endpoint + 'search' , params = {'q' : query })
4949 if not r .ok :
5050 raise APIError (r .json ()['error' ])
51- return r .json ()['search' ]
51+ search_result = r .json ()['search' ]
52+ # convert publisher, creative dicts etc from search result to Atomx.model
53+ for m in search_result .keys ():
54+ model_name = get_model_name (m )
55+ if model_name :
56+ search_result [m ] = [getattr (models , model_name )(self , ** v )
57+ for v in search_result [m ]]
58+ return search_result
5259
5360 def get (self , resource , ** kwargs ):
5461 r = self .session .get (self .api_endpoint + resource , params = kwargs )
You can’t perform that action at this time.
0 commit comments