generated from mwc/lab_server
	Merge branch 'main' of https://git.makingwithcode.org/cchung/lab_server into main
This commit is contained in:
		@@ -19,7 +19,7 @@ def get_random_line_that_rhymes_with(params):
 | 
				
			|||||||
    try:
 | 
					    try:
 | 
				
			||||||
        return {'line': Rhyme.get_rhyme_for_word(params['rhyme']).lines.exclude(clean_text__endswith=params['rhyme']).random().text}
 | 
					        return {'line': Rhyme.get_rhyme_for_word(params['rhyme']).lines.exclude(clean_text__endswith=params['rhyme']).random().text}
 | 
				
			||||||
    except:
 | 
					    except:
 | 
				
			||||||
        raise BadRequest(f'Error 400: Sorry, there are no lines that rhyme with {params['topic']}.')
 | 
					        raise BadRequest(f"Error 400: Sorry, there are no lines that rhyme with {params['topic']}.")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@route_get('couplets/random',args={})
 | 
					@route_get('couplets/random',args={})
 | 
				
			||||||
def get_random_couplet(params):
 | 
					def get_random_couplet(params):
 | 
				
			||||||
@@ -34,7 +34,7 @@ def get_random_couplet_about(params):
 | 
				
			|||||||
        second_line=first_line.rhyming_lines().random()
 | 
					        second_line=first_line.rhyming_lines().random()
 | 
				
			||||||
        return {'lines': [first_line.text,second_line.text]}
 | 
					        return {'lines': [first_line.text,second_line.text]}
 | 
				
			||||||
    except:
 | 
					    except:
 | 
				
			||||||
        raise BadRequest(f'Error 400: Sorry, there are not lines that contain the word {params['topic']}.')
 | 
					        raise BadRequest(f"Error 400: Sorry, there are not lines that contain the word {params['topic']}.")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@route_get('couplets/rhyme',args={'rhyme': str})
 | 
					@route_get('couplets/rhyme',args={'rhyme': str})
 | 
				
			||||||
def get_random_couplet_that_rhymes_with(params):
 | 
					def get_random_couplet_that_rhymes_with(params):
 | 
				
			||||||
@@ -43,11 +43,11 @@ def get_random_couplet_that_rhymes_with(params):
 | 
				
			|||||||
        second_line = first_line.rhyming_lines().random()
 | 
					        second_line = first_line.rhyming_lines().random()
 | 
				
			||||||
        return {'lines': [first_line.text,second_line.text]}
 | 
					        return {'lines': [first_line.text,second_line.text]}
 | 
				
			||||||
    except:
 | 
					    except:
 | 
				
			||||||
        raise BadRequest(f'Error 400: Sorry, there are not at least two lines that rhyme with {params['topic']}.')
 | 
					        raise BadRequest(f"Error 400: Sorry, there are not at least two lines that rhyme with {params['topic']}.")
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
@route_get('word/rhyme',args={'rhyme': str})
 | 
					@route_get('word/rhyme',args={'rhyme': str})
 | 
				
			||||||
def get_random_word_that_rhymes_with(params):
 | 
					def get_random_word_that_rhymes_with(params):
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        return {'word': Rhyme.get_rhyme_for_word(params['rhyme']).lines.exclude(clean_text__endswith=params['rhyme']).random().last_word()}
 | 
					        return {'word': Rhyme.get_rhyme_for_word(params['rhyme']).lines.exclude(clean_text__endswith=params['rhyme']).random().last_word()}
 | 
				
			||||||
    except:
 | 
					    except:
 | 
				
			||||||
        raise BadRequest(f'Error 400: Sorry, there are no words that rhyme with {params['rhyme']}.')
 | 
					        raise BadRequest(f"Error 400: Sorry, there are no words that rhyme with {params['rhyme']}.")
 | 
				
			||||||
		Reference in New Issue
	
	Block a user