def main(): arg_parser = common.create_arg_parser() grpc_server, file_server = common.services(arg_parser) service = common.create_service(grpc_server) p = MyPrompt(service, file_server) p.cmdloop()
#!/usr/bin/env python3 import common import witness.api.witness_pb2 as witness_pb2 import witness.api.witness_pb2_grpc as witness_pb2_grpc DEFAULT_TIMEOUT = 5 # seconds def open_webcam(service_stub, device=1): open_request = witness_pb2.OpenWebcamRequest() open_request.webcam_id = device reply = service_stub.OpenWebcam(open_request, DEFAULT_TIMEOUT) print(reply) if __name__ == '__main__': arg_parser = common.create_arg_parser() grpc_server, _ = common.services(arg_parser) service_stub = common.create_service(grpc_server) open_webcam(service_stub)
# ensure that the property types match the types defined in types.py result['property_type'] = convert_property_type( result['property_type']) return results types_conversion_table = { 1: 1, 2: 9, 3: 2, 4: 3, 5: 5, 6: 11, 7: 6, 8: 8, 9: 7, } def convert_property_type(code): return types_conversion_table.get(int(code), 10) # default 10 if __name__ == '__main__': parser = create_arg_parser('Webscrape property data from bolighed.dk') args = vars(parser.parse_args()) save = args['save'] found = get_all_results(args['max_results']) write_or_append(save, found, args['append'])