def get_camera(self): if self.config.URL: url = URL(self.config.URL) auth = url.username(), url.password() if url.username is None and url.password is None: auth = None url = URL(url.as_string(), username='', password='') return FoscamHTTPCamera(url.as_string(), auth) else: return USBCamera(self.config.DEVICE)
host='www.google.com', path='/search', query='q=google') print(argument_url) print(argument_url.as_string()) inline_url = URL().scheme('https').domain('www.google.com').path( 'search').query_param('q', 'google') print(inline_url) print(inline_url.as_string()) u = URL('postgres://*****:*****@localhost:1234/test?ssl=true') print(u.scheme()) print(u.host()) print(u.domain()) print(u.username()) print(u.password()) print(u.netloc()) print(u.port()) print(u.path()) print(u.query()) print(u.path_segments()) print(u.query_param('ssl')) print(u.query_param('ssl', as_list=True)) print(u.query_params()) print(u.has_query_param('ssl')) print(u.subdomains()) u = URL.from_string('https://github.com/minwook-shin') print(u.path_segment(0)) new_url = u.add_path_segment('minwook-shin.github.com')