-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheapweedfinder.py
129 lines (102 loc) · 3.64 KB
/
cheapweedfinder.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import os
import json
from functions import dutchrequest, janerequest, clear
# Purpose: Find the best deals on weed using requests and simple math
# Author: cat-thats-fat
# Date: 10-04-2024
# Version: 3.0.0
# Current Task: Rewrite interface
# To-Do:
# Clean up all the code
# Add documentation
def main(config):
filters = {
"categories": ["Flower", "Pre-Rolls", "Vaporizer", "Concentrates"],
"strains": ['Sativa', "Indica", "Hybrid", "No Preference"]
}
clear()
print("Cheap Weed Finder \n")
print(f"Current Category: {filters['categories'][config["choices"]["category"]]}")
print(f"Current Strain: {filters['strains'][config["choices"]["strain"]]} \n")
print("1. Search")
print("2. Change search parameters")
print("3. Save & Exit \n")
choice = int(input("Enter choice: "))
if choice == 1:
clear()
print("Cheap Weed Finder \n")
print("Progress:")
output = {}
count = 0
dispos = len(config["dutchIDS"]) + len(config["janeIDS"])
# search dutchie IDS
for dispo in config["dutchIDS"]:
info = config["dutchIDS"][dispo]
output[dispo] = dutchrequest(info, config)
count += 1
print(f"Sites searched: {count}/{dispos}")
for dispo in config["janeIDS"]:
info = config["janeIDS"][dispo]
output[dispo] = janerequest(info, config)
count += 1
print(f"Sites searched: {count}/{dispos}")
with open("output.json", "w") as f:
json.dump(output, f, indent=6)
f.close
print("Search complete and results saved.")
input("Press enter to return home...")
main(config)
elif choice == 2:
clear()
print("Cheap Weed Finder")
print("Change Parameters")
print()
print("Categories: Flower(1), Pre-Rolls(2), Vaporizers(3), Concentrate(4)")
print("Strains: Sativa(1), Indica(2), Hybrid(3), No Preference(4)")
print()
config["choices"]["category"] = int(input("Which category would you like to search for?")) - 1
config["choices"]["strain"] = int(input("Which strain would you like to search for?")) - 1
input("Changes saved, press enter to return home...")
main(config)
elif choice == 3:
with open("config.json", "w") as f:
json.dump(config, f, indent=4)
f.close
clear()
exit()
def setup():
clear()
if not os.path.exists("config.json"):
print("Welcome to Cheap Weed Finder by cat-thats-fat")
print("It appears to be your first time using CWF as the config file cannot be found.")
config_template = {
"choices": {
"category": 0,
"strain": 0
},
"dutchIDS": {
"DISPENSARY NAME": {
"id": "R3PL4C3_TH15_W1TH_TH3_1D",
"discount": 420
},
},
"janeIDS": {
"DISPENSARY NAME": {
"id": "1234",
"discount": 420
},
}
}
with open("config.json", "w") as f:
json.dump(config_template, f, indent=4)
f.close
print("Config file created")
print("Fill in the config file, follow the instructions in the readme to find the IDS.")
input("Press enter to exit....")
exit()
if __name__ == "__main__":
setup()
with open("config.json", "r") as f:
config = json.load(f)
f.close()
main(config)