Compare commits
	
		
			No commits in common. "e44414fa6579ed364f967f7bd412e2cb862d8946" and "78194437a996a6bf8c582ca3a8b43df8978806d0" have entirely different histories.
		
	
	
		
			e44414fa65
			...
			78194437a9
		
	
		
| 
						 | 
					@ -13,5 +13,4 @@ These Python scripts allow to extract records from the DineConnect API and post
 | 
				
			||||||
* Copy the file `config-sample.py` to `config.py`.
 | 
					* Copy the file `config-sample.py` to `config.py`.
 | 
				
			||||||
* Edit `config.py` with your credentials and defaults.
 | 
					* Edit `config.py` with your credentials and defaults.
 | 
				
			||||||
* To extract the tickets records from the DineConnect API and post them to the Mongo database, run `python3 extract_tickets.py` and follow the instructions of the script.
 | 
					* To extract the tickets records from the DineConnect API and post them to the Mongo database, run `python3 extract_tickets.py` and follow the instructions of the script.
 | 
				
			||||||
* To delete tickets from the Mongo database, run `python3 delte_tickets.py` and follow de instructions of the script.
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,7 +4,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| Version | Supported          |
 | 
					| Version | Supported          |
 | 
				
			||||||
| ------- | ------------------ |
 | 
					| ------- | ------------------ |
 | 
				
			||||||
| 0.2.x   | :heavy_check_mark: |
 | 
					 | 
				
			||||||
| 0.1.x   | :heavy_check_mark: |
 | 
					| 0.1.x   | :heavy_check_mark: |
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Reporting
 | 
					## Reporting
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										16
									
								
								delete.py
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								delete.py
									
									
									
									
									
								
							| 
						 | 
					@ -1,16 +0,0 @@
 | 
				
			||||||
from pymongo import MongoClient
 | 
					 | 
				
			||||||
from config import *
 | 
					 | 
				
			||||||
import sys
 | 
					 | 
				
			||||||
import json
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
def delete(query_filter):
 | 
					 | 
				
			||||||
	client = MongoClient(CONNECTION_STRING)
 | 
					 | 
				
			||||||
	database = client[DATABASE]
 | 
					 | 
				
			||||||
	collection = database[COLLECTION]
 | 
					 | 
				
			||||||
	result = collection.delete_many(json.loads(query_filter))
 | 
					 | 
				
			||||||
	print(result.raw_result)
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
if __name__ == '__main__':
 | 
					 | 
				
			||||||
    delete(sys.argv[1])
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
| 
						 | 
					@ -1,19 +0,0 @@
 | 
				
			||||||
import requests
 | 
					 | 
				
			||||||
import json
 | 
					 | 
				
			||||||
from config import *
 | 
					 | 
				
			||||||
from delete import *
 | 
					 | 
				
			||||||
import sys
 | 
					 | 
				
			||||||
import base64
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
def delete_tickets():
 | 
					 | 
				
			||||||
    from_date = str(input('From date [YYYY-MM-DD]: ') or "")
 | 
					 | 
				
			||||||
    to_date = str(input('To date YYYY-MM-DD]: ') or "")
 | 
					 | 
				
			||||||
    query_filter = json.dumps({
 | 
					 | 
				
			||||||
        "businessDate": {'$gte': from_date+"T00:00:00", '$lte': to_date+"T00:00:00"}
 | 
					 | 
				
			||||||
        })
 | 
					 | 
				
			||||||
    print(query_filter)
 | 
					 | 
				
			||||||
    delete(query_filter)
 | 
					 | 
				
			||||||
     
 | 
					 | 
				
			||||||
if __name__ == '__main__':
 | 
					 | 
				
			||||||
    delete_tickets()
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
		Loading…
	
		Reference in a new issue