from urllib.parse import urlparse parsed = reload_redirect['Location'] if parsed.query: parsed.query += f'&{redirect_parameters}' else: parsed.query = redirect_parameters
reload_redirect['Location'] = parsed.geturl() pripadne path, *parameters = reload_redirect['Location'].split('?', 1) parameters.append(redirect_parameters) reload_redirect['Location'] = '%s?%s' % (path, '&'.join(parameters)) Honza Král E-Mail: honza.k...@gmail.com Phone: +420 606 678585 2018-04-10 12:41 GMT+01:00 <azu...@pobox.sk>: > Ja by som najskor zozbieral vsetky parametre do pola a potom tesne pred > odoslanim hlaviciek: > > if redirect_parameters: > reload_redirect['Location'] += "?%s" % "&".join(redirect_parameters) > > > > > > > Citát Petr Messner <petr.mess...@gmail.com>: > > >> Nevim, neznam, asi uz ani nejsem webovy vyvojar :D >> >> Navrhuju to schovat do funkce: >> >> reload_redirect['Location'] = append_redirect_param( >> reload_redirect['Location'], 'param=1') >> >> def append_redirect_param(...): >> .... >> >> >> Petr M. >> >> >> 2018-04-10 13:09 GMT+02:00 Vláďa Macek <ma...@sandbox.cz>: >> >>> Zdar, >>> >>> vyhlasuju soutez o nejhezci alternativu pro toto: >>> >>> reload_redirect['Location'] += '#param=1'.replace('#', '&' if '?' in >>> reload_redirect['Location'] else '?') >>> >>> Webovi vyvojari jiste zalezitost znaji. >>> Tesim se ;-) >>> >>> Vlada >>> >>> > > > > _______________________________________________ > Python mailing list > python@py.cz > http://www.py.cz/mailman/listinfo/python > > Visit: http://www.py.cz _______________________________________________ Python mailing list python@py.cz http://www.py.cz/mailman/listinfo/python Visit: http://www.py.cz