I need some help with the following I'm trying to do:
To modify individual dictionary values for each key (a param in this case) for only a single param at a time with a value from self.fooz for each iteration.
like this
So a url like:
somesite.com?id=6&name=Billwould becomesomesite.com?id=<self.fooz>&name=Bill(iterating for the number of individual foozes) then,somesite.com?id=6&name=<self.fooz>(iterating for the number of individual foozes)
Finally, generating a full_param_vector and full_param values as discussed below
Can someone please help me?
I've done:
1) A set of raw paths are brought in via self.path_object)
2) parse the paths after the ? to grab all the raw parametrized key/values (via parse_after)
I wrote down some pseudocode of what I'm trying to accomplish:
if self.path_object is not None:
dictpath = {}
for path in self.path_object:
#path.pathToScan - returns a full url e.g. somesite.com?id=6&name=Bill
#parse_after returns a string with parameters only, like: {u'id': [u'2'], u'name': [u'Dog']}
parse_after = urlparse.parse_qs(path.pathToScan[path.pathToScan.find('?') + 1:], keep_blank_values=0, strict_parsing=0)
#for each params in 'parse_after':
#replace a key's value from params with a value from self.foozs,
#loop over this single key inserting a single value from self.fooz for each param for all fooz_objects, then continue to the next param and do the same
#create full_param_vector var with these new values
#construct full_path made up of: path.pathToScan - <part before '?'> + "?" + full_param_vector
#add all 'full_path' to a dictionary named dictpath
#print dictpath
Any help is welcome. Thank you
query = urlparse.urlparse(path.pathToScan).query; parse_after = urlparse.parse_qs(query, keep_blank_values=0, strict_parsing=0)urlparse()but rather the data.Path.pathsToScanreturns a full url likesomesite.com/path/here/?param=6&name=Billwhereas yourqueryvar just returns theparameters. The part that is missing, and is messing all this up is if a path has 1 or morepathsafter thedomain