facho: cli generate se adiciona --ssl/--no-ssl.
FossilOrigin-Name: 6aa66a452f183d09ccff916e6d8194e98ac60aa1d8e5df5423374ac00b2b385a
This commit is contained in:
		
							
								
								
									
										14
									
								
								facho/cli.py
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								facho/cli.py
									
									
									
									
									
								
							@@ -1,5 +1,6 @@
 | 
				
			|||||||
import sys
 | 
					import sys
 | 
				
			||||||
import base64
 | 
					import base64
 | 
				
			||||||
 | 
					import warnings
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import click
 | 
					import click
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -190,14 +191,25 @@ def validate_invoice(invoice_path):
 | 
				
			|||||||
@click.option('--private-key', type=click.Path(exists=True))
 | 
					@click.option('--private-key', type=click.Path(exists=True))
 | 
				
			||||||
@click.option('--generate/--validate', default=False)
 | 
					@click.option('--generate/--validate', default=False)
 | 
				
			||||||
@click.option('--passphrase')
 | 
					@click.option('--passphrase')
 | 
				
			||||||
 | 
					@click.option('--ssl/--no-ssl', default=False)
 | 
				
			||||||
@click.argument('scriptname', type=click.Path(exists=True), required=True)
 | 
					@click.argument('scriptname', type=click.Path(exists=True), required=True)
 | 
				
			||||||
def generate_invoice(private_key, passphrase, scriptname, generate=False):
 | 
					def generate_invoice(private_key, passphrase, scriptname, generate=False, ssl=True):
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    imprime xml en pantalla.
 | 
					    imprime xml en pantalla.
 | 
				
			||||||
    SCRIPTNAME espera 
 | 
					    SCRIPTNAME espera 
 | 
				
			||||||
     def invoice() -> form.Invoice
 | 
					     def invoice() -> form.Invoice
 | 
				
			||||||
     def extensions(form.Invoice): -> List[facho.FachoXMLExtension]
 | 
					     def extensions(form.Invoice): -> List[facho.FachoXMLExtension]
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # MACHETE
 | 
				
			||||||
 | 
					    if not ssl:
 | 
				
			||||||
 | 
					        import ssl
 | 
				
			||||||
 | 
					        if getattr(ssl, '_create_unverified_context', None):
 | 
				
			||||||
 | 
					            ssl._create_default_https_context = ssl._create_unverified_context
 | 
				
			||||||
 | 
					            warnings.warn("be sure!! ssl disable")
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
 | 
					            warnings.warn("can't disable ssl")
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
    import importlib.util
 | 
					    import importlib.util
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    spec = importlib.util.spec_from_file_location('invoice', scriptname)
 | 
					    spec = importlib.util.spec_from_file_location('invoice', scriptname)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user