Added a few more example usages.
This commit is contained in:
		
							parent
							
								
									e05dee87a8
								
							
						
					
					
						commit
						a278b7dc72
					
				| 
						 | 
					@ -0,0 +1,20 @@
 | 
				
			||||||
 | 
					import scrython
 | 
				
			||||||
 | 
					import time
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					query = input("Name a card: ")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					auto = ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					try:
 | 
				
			||||||
 | 
					    time.sleep(0.05)
 | 
				
			||||||
 | 
					    card = scrython.cards.Named(exact=query)
 | 
				
			||||||
 | 
					except Exception:
 | 
				
			||||||
 | 
					    time.sleep(0.05)
 | 
				
			||||||
 | 
					    auto = scrython.cards.Autocomplete(q=query, query=query)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if auto:
 | 
				
			||||||
 | 
					    print("Did you mean?")
 | 
				
			||||||
 | 
					    for item in auto.data():
 | 
				
			||||||
 | 
					        print(item)
 | 
				
			||||||
 | 
					else:
 | 
				
			||||||
 | 
					    print(card.name())
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,14 @@
 | 
				
			||||||
 | 
					import scrython
 | 
				
			||||||
 | 
					import time
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					query = input("Type the name of the set: ")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					time.sleep(0.05)
 | 
				
			||||||
 | 
					sets = scrython.sets.Sets()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					for i in range(sets.data_length()):
 | 
				
			||||||
 | 
					    if sets.set_name(i) == query:
 | 
				
			||||||
 | 
					        print("Set code:", sets.set_code(i).upper())
 | 
				
			||||||
 | 
					        break
 | 
				
			||||||
 | 
					    else:
 | 
				
			||||||
 | 
					        continue
 | 
				
			||||||
		Loading…
	
		Reference in New Issue