{{ message }}

Instantly share code, notes, and snippets.

# natanlao/genius.py

Last active Mar 22, 2020
Sticker genius quote crawler
 #!/usr/bin/env python3.6 # -*- coding: utf-8 -*- # Get quotes from Sticker Genius for the kind of sticker we are going to buy so that # we can pay less money for more stickers. # Should be easy enough to tweak this code for different products - I used Firefox # developer tools to inspect requests made to getPrice.php. from decimal import Decimal, ROUND_05UP import time import requests endpoint = 'https://www.stickergenius.com/wp-content/plugins/stickergenius_pricing_grid/getPrice.php' def get_price(quantity): f = str(1.14586) payload = { 'action': 'sticker_get_price', 'width': 2.5, 'height': 2.5, 'quantity': quantity, 'f': f, 'i': 17848, 'o': '', 'm': 'GV', 'v': 'hidden_price_plugin_vars:17848|99999|2.5|2.5|1.14586|GV||GLG|Custom+Shape+Clear+Vinyl||||||', 'glcode': '' } r = requests.post(endpoint, data=payload) # Price per individual sticker price_ind = Decimal(r.text.lstrip('#\$').rstrip('#')) * Decimal(f) price_ind = price_ind.quantize(Decimal('1.00'), rounding=ROUND_05UP) # Total price is individual price * quantity return price_ind * quantity if __name__ == '__main__': results = [] for i in range(1, 1000, 3): results.append((str(i), str(get_price(i)))) time.sleep(2) with open('results.csv', 'w') as f: for quant, price in results: f.write(f"{quant},{price}\n")
1 14.39 2 22.28 3 23.73 4 27.36 5 28.80 6 31.86 7 34.16 8 35.44 9 35.91 10 35.60 11 38.17 12 40.32 13 42.51 14 44.52 15 46.35 16 48.16 17 49.47 18 50.58 19 51.68 20 52.60 21 53.34 22 54.12 23 54.28 24 54.24 25 54.25 26 55.64 27 56.97 28 58.24 29 59.74 30 60.60 31 62.31 32 63.04 33 64.02 34 64.94 35 66.15 36 66.96 37 67.71 38 68.02 39 69.03 40 69.60 41 70.11 42 70.56 43 71.38 44 71.28 45 72.45 46 71.76 47 72.38 48 72.48 49 72.52 50 73.00 51 73.44 52 74.36 53 75.26 54 76.14 55 76.45 56 77.28 57 78.09 58 78.88 59 80.24 60 80.40 61 80.52 62 81.22 63 82.53 64 83.84 65 83.85 66 84.48 67 85.09 68 85.68 69 85.56 70 86.10 71 86.62 72 87.12 73 88.33 74 88.06 75 88.50 76 88.16 77 89.32 78 88.92 79 89.27 80 89.60 81 89.91 82 91.02 83 89.64 84 89.88 85 90.10 86 91.16 87 92.22 88 91.52 89 91.67 90 90.90 91 91.91 92 91.08 93 91.14 94 91.18 95 91.20 96 92.16 97 90.21 98 90.16 99 90.09 100 91.00 101 91.91 102 92.82 103 93.73 104 92.56 105 93.45 106 94.34 107 95.23 108 96.12 109 95.92 110 96.80 111 97.68 112 98.56 113 99.44 114 100.32 115 100.05 116 100.92 117 101.79 118 102.66 119 103.53 120 104.40 121 104.06 122 104.92 123 105.78 124 106.64 125 107.50 126 108.36 127 106.68 128 107.52 129 108.36 130 109.20 131 110.04 132 110.88 133 110.39 134 111.22 135 112.05 136 112.88 137 113.71 138 113.16 139 113.98 140 114.80 141 115.62 142 116.44 143 117.26 144 116.64 145 117.45 146 118.26 147 119.07 148 119.88 149 120.69 150 121.50 151 122.31 152 123.12 153 123.93 154 124.74 155 125.55 156 123.24 157 124.03 158 124.82 159 125.61 160 126.40 161 123.97 162 124.74 163 125.51 164 126.28 165 127.05 166 127.82 167 126.92 168 127.68 169 128.44 170 129.20 171 129.96 172 130.72 173 131.48 174 132.24 175 133.00 176 133.76 177 134.52 178 135.28 179 132.46 180 133.20 181 133.94 182 134.68 183 135.42 184 136.16 185 135.05 186 135.78 187 136.51 188 137.24 189 137.97 190 136.80 191 137.52 192 138.24 193 138.96 194 139.68 195 140.40 196 139.16 197 139.87 198 140.58 199 141.29 200 142.00 201 142.71 202 139.38 203 140.07 204 140.76 205 141.45 206 142.14 207 142.83 208 141.44 209 142.12 210 142.80 211 143.48 212 144.16 213 144.84 214 143.38 215 144.05 216 144.72 217 145.39 218 146.06 219 144.54 220 145.20 221 145.86 222 146.52 223 147.18 224 147.84 225 148.50 226 149.16 227 149.82 228 150.48 229 151.14 230 151.80 231 147.84 232 148.48 233 149.12 234 149.76 235 150.40 236 151.04 237 149.31 238 149.94 239 150.57 240 151.20 241 151.83 242 152.46 243 148.23 244 148.84 245 149.45 246 150.06 247 150.67 248 151.28 249 151.89 250 152.50 251 153.11 252 153.72 253 154.33 254 149.86 255 150.45 256 151.04 257 151.63 258 152.22 259 152.81 260 150.80 261 151.38 262 151.96 263 152.54 264 153.12 265 153.70 266 151.62 267 152.19 268 152.76 269 153.33 270 153.90 271 154.47 272 152.32 273 152.88 274 153.44 275 154.00 276 154.56 277 155.12 278 155.68 279 156.24 280 156.80 281 157.36 282 157.92 283 149.99 284 150.52 285 151.05 286 151.58 287 152.11 288 152.64 289 150.28 290 150.80 291 151.32 292 151.84 293 152.36 294 152.88 295 150.45 296 150.96 297 151.47 298 151.98 299 152.49 300 153.00 301 153.51 302 154.02 303 154.53 304 155.04 305 155.55 306 156.06 307 156.57 308 157.08 309 157.59 310 158.10 311 158.61 312 159.12 313 159.63 314 160.14 315 160.65 316 161.16 317 161.67 318 162.18 319 162.69 320 163.20 321 157.29 322 157.78 323 158.27 324 158.76 325 159.25 326 159.74 327 160.23 328 160.72 329 161.21 330 161.70 331 162.19 332 162.68 333 163.17 334 163.66 335 164.15 336 164.64 337 165.13 338 165.62 339 166.11 340 166.60 341 167.09 342 164.16 343 164.64 344 165.12 345 165.60 346 166.08 347 166.56 348 167.04 349 167.52 350 168.00 351 168.48 352 168.96 353 169.44 354 169.92 355 170.40 356 170.88 357 171.36 358 171.84 359 172.32 360 172.80 361 173.28 362 173.76 363 166.98 364 167.44 365 167.90 366 168.36 367 168.82 368 169.28 369 169.74 370 170.20 371 170.66 372 171.12 373 171.58 374 172.04 375 172.50 376 172.96 377 173.42 378 173.88 379 174.34 380 174.80 381 175.26 382 175.72 383 176.18 384 176.64 385 177.10 386 177.56 387 178.02 388 178.48 389 178.94 390 179.40 391 179.86 392 180.32 393 180.78 394 181.24 395 181.70 396 182.16 397 182.62 398 183.08 399 183.54 400 184.00 401 184.46 402 184.92 403 185.38 404 185.84 405 178.20 406 178.64 407 179.08 408 179.52 409 179.96 410 180.40 411 180.84 412 181.28 413 181.72 414 182.16 415 182.60 416 183.04 417 183.48 418 183.92 419 184.36 420 184.80 421 185.24 422 185.68 423 186.12 424 186.56 425 187.00 426 183.18 427 183.61 428 184.04 429 184.47 430 184.90 431 185.33 432 185.76 433 186.19 434 186.62 435 187.05 436 187.48 437 187.91 438 188.34 439 188.77 440 189.20 441 189.63 442 190.06 443 190.49 444 190.92 445 191.35 446 191.78 447 187.74 448 188.16 449 188.58 450 189.00 451 189.42 452 189.84 453 190.26 454 190.68 455 191.10 456 191.52 457 191.94 458 192.36 459 192.78 460 193.20 461 193.62 462 194.04 463 194.46 464 194.88 465 195.30 466 195.72 467 196.14 468 191.88 469 192.29 470 192.70 471 193.11 472 193.52 473 193.93 474 194.34 475 194.75 476 195.16 477 195.57 478 195.98 479 196.39 480 196.80 481 197.21 482 197.62 483 198.03 484 198.44 485 198.85 486 199.26 487 199.67 488 200.08 489 200.49 490 200.90 491 201.31 492 201.72 493 202.13 494 202.54 495 202.95 496 203.36 497 203.77 498 204.18 499 204.59 500 205.00 501 205.41 502 205.82 503 206.23 504 206.64 505 207.05 506 207.46 507 207.87 508 208.28 509 208.69 510 209.10 511 209.51 512 209.92 513 210.33 514 210.74 515 211.15 516 211.56 517 211.97 518 212.38 519 212.79 520 213.20 521 213.61 522 214.02 523 214.43 524 214.84 525 215.25 526 215.66 527 216.07 528 216.48 529 216.89 530 201.40 531 201.78 532 202.16 533 202.54 534 202.92 535 203.30 536 203.68 537 204.06 538 204.44 539 204.82 540 205.20 541 205.58 542 205.96 543 206.34 544 206.72 545 207.10 546 207.48 547 207.86 548 208.24 549 208.62 550 209.00 551 209.38 552 209.76 553 210.14 554 210.52 555 210.90 556 211.28 557 211.66 558 212.04 559 212.42 560 212.80 561 213.18 562 213.56 563 213.94 564 214.32 565 214.70 566 215.08 567 215.46 568 215.84 569 216.22 570 216.60 571 216.98 572 217.36 573 217.74 574 218.12 575 218.50 576 218.88 577 219.26 578 219.64 579 220.02 580 220.40 581 220.78 582 221.16 583 221.54 584 221.92 585 222.30 586 222.68 587 223.06 588 223.44 589 223.82 590 224.20 591 224.58 592 224.96 593 225.34 594 219.78 595 220.15 596 220.52 597 220.89 598 221.26 599 221.63 600 222.00 601 222.37 602 222.74 603 223.11 604 223.48 605 223.85 606 224.22 607 224.59 608 224.96 609 225.33 610 225.70 611 226.07 612 226.44 613 226.81 614 227.18 615 227.55 616 227.92 617 228.29 618 228.66 619 229.03 620 229.40 621 229.77 622 230.14 623 230.51 624 230.88 625 231.25 626 231.62 627 231.99 628 232.36 629 232.73 630 233.10 631 233.47 632 233.84 633 234.21 634 234.58 635 234.95 636 235.32 637 235.69 638 236.06 639 236.43 640 236.80 641 237.17 642 237.54 643 237.91 644 238.28 645 238.65 646 239.02 647 239.39 648 239.76 649 240.13 650 240.50 651 240.87 652 241.24 653 241.61 654 241.98 655 242.35 656 242.72 657 243.09 658 243.46 659 237.24 660 237.60 661 237.96 662 238.32 663 238.68 664 239.04 665 239.40 666 239.76 667 240.12 668 240.48 669 240.84 670 241.20 671 241.56 672 241.92 673 242.28 674 242.64 675 243.00 676 243.36 677 243.72 678 244.08 679 244.44 680 244.80 681 245.16 682 245.52 683 245.88 684 246.24 685 246.60 686 246.96 687 247.32 688 247.68 689 248.04 690 248.40 691 248.76 692 249.12 693 249.48 694 249.84 695 250.20 696 250.56 697 250.92 698 251.28 699 251.64 700 252.00 701 252.36 702 252.72 703 253.08 704 253.44 705 253.80 706 254.16 707 254.52 708 254.88 709 255.24 710 255.60 711 255.96 712 256.32 713 256.68 714 257.04 715 257.40 716 257.76 717 258.12 718 258.48 719 258.84 720 259.20 721 259.56 722 259.92 723 260.28 724 260.64 725 261.00 726 261.36 727 261.72 728 262.08 729 262.44 730 262.80 731 263.16 732 263.52 733 263.88 734 264.24 735 264.60 736 264.96 737 265.32 738 265.68 739 266.04 740 266.40 741 266.76 742 267.12 743 267.48 744 267.84 745 268.20 746 268.56 747 268.92 748 269.28 749 269.64 750 270.00 751 270.36 752 270.72 753 271.08 754 271.44 755 271.80 756 272.16 757 272.52 758 272.88 759 273.24 760 273.60 761 273.96 762 274.32 763 274.68 764 275.04 765 275.40 766 275.76 767 276.12 768 276.48 769 276.84 770 277.20 771 277.56 772 277.92 773 278.28 774 278.64 775 279.00 776 279.36 777 279.72 778 280.08 779 280.44 780 280.80 781 281.16 782 281.52 783 281.88 784 282.24 785 282.60 786 282.96 787 283.32 788 283.68 789 268.26 790 268.60 791 268.94 792 269.28 793 269.62 794 269.96 795 270.30 796 270.64 797 270.98 798 271.32 799 271.66 800 272.00 801 272.34 802 272.68 803 273.02 804 273.36 805 273.70 806 274.04 807 274.38 808 274.72 809 275.06 810 275.40 811 275.74 812 276.08 813 276.42 814 276.76 815 277.10 816 277.44 817 277.78 818 278.12 819 278.46 820 278.80 821 279.14 822 279.48 823 279.82 824 280.16 825 280.50 826 280.84 827 281.18 828 281.52 829 281.86 830 282.20 831 282.54 832 282.88 833 283.22 834 283.56 835 283.90 836 284.24 837 284.58 838 284.92 839 285.26 840 285.60 841 285.94 842 286.28 843 286.62 844 286.96 845 287.30 846 287.64 847 287.98 848 288.32 849 288.66 850 289.00 851 289.34 852 289.68 853 281.49 854 281.82 855 282.15 856 282.48 857 282.81 858 283.14 859 283.47 860 283.80 861 284.13 862 284.46 863 284.79 864 285.12 865 285.45 866 285.78 867 286.11 868 286.44 869 286.77 870 287.10 871 287.43 872 287.76 873 288.09 874 288.42 875 288.75 876 289.08 877 289.41 878 289.74 879 290.07 880 290.40 881 290.73 882 291.06 883 291.39 884 291.72 885 292.05 886 292.38 887 292.71 888 293.04 889 293.37 890 293.70 891 294.03 892 294.36 893 294.69 894 295.02 895 295.35 896 295.68 897 296.01 898 296.34 899 296.67 900 297.00 901 297.33 902 297.66 903 297.99 904 298.32 905 298.65 906 298.98 907 299.31 908 299.64 909 299.97 910 300.30 911 300.63 912 300.96 913 301.29 914 301.62 915 301.95 916 302.28 917 302.61 918 293.76 919 294.08 920 294.40 921 294.72 922 295.04 923 295.36 924 295.68 925 296.00 926 296.32 927 296.64 928 296.96 929 297.28 930 297.60 931 297.92 932 298.24 933 298.56 934 298.88 935 299.20 936 299.52 937 299.84 938 300.16 939 300.48 940 300.80 941 301.12 942 301.44 943 301.76 944 302.08 945 302.40 946 302.72 947 303.04 948 303.36 949 303.68 950 304.00 951 304.32 952 304.64 953 304.96 954 305.28 955 305.60 956 305.92 957 306.24 958 306.56 959 306.88 960 307.20 961 307.52 962 307.84 963 308.16 964 308.48 965 308.80 966 309.12 967 309.44 968 309.76 969 310.08 970 310.40 971 310.72 972 311.04 973 311.36 974 311.68 975 312.00 976 312.32 977 312.64 978 312.96 979 313.28 980 313.60 981 313.92 982 314.24 983 304.73 984 305.04 985 305.35 986 305.66 987 305.97 988 306.28 989 306.59 990 306.90 991 307.21 992 307.52 993 307.83 994 308.14 995 308.45 996 308.76 997 309.07 998 309.38 999 309.69 1000 310.00 1001 310.31 1002 310.62 1003 310.93 1004 311.24 1005 311.55 1006 311.86 1007 312.17 1008 312.48 1009 312.79 1010 313.10 1011 313.41 1012 313.72 1013 314.03 1014 314.34 1015 314.65 1016 314.96 1017 315.27 1018 315.58 1019 315.89 1020 316.20 1021 316.51 1022 316.82 1023 317.13 1024 317.44 1025 317.75 1026 318.06 1027 318.37 1028 318.68 1029 318.99 1030 319.30 1031 319.61 1032 319.92 1033 320.23 1034 320.54 1035 320.85 1036 321.16 1037 321.47 1038 321.78 1039 322.09 1040 322.40 1041 322.71 1042 323.02 1043 323.33 1044 323.64 1045 323.95 1046 324.26 1047 324.57 1048 324.88 1049 325.19 1050 325.50 1051 325.81 1052 326.12 1053 326.43 1054 326.74 1055 327.05 1056 327.36 1057 327.67 1058 327.98 1059 328.29 1060 328.60 1061 328.91 1062 329.22 1063 329.53 1064 329.84 1065 330.15 1066 330.46 1067 330.77 1068 331.08 1069 331.39 1070 331.70 1071 332.01 1072 332.32 1073 332.63 1074 332.94 1075 333.25 1076 333.56 1077 333.87 1078 334.18 1079 334.49 1080 334.80 1081 335.11 1082 335.42 1083 335.73 1084 336.04 1085 336.35 1086 336.66 1087 336.97 1088 337.28 1089 337.59 1090 337.90 1091 338.21 1092 338.52 1093 338.83 1094 339.14 1095 339.45 1096 339.76 1097 340.07 1098 340.38 1099 340.69 1100 341.00 1101 341.31 1102 341.62 1103 341.93 1104 342.24 1105 342.55 1106 342.86 1107 343.17 1108 343.48 1109 343.79 1110 344.10 1111 344.41 1112 344.72 1113 345.03 1114 345.34 1115 345.65 1116 345.96 1117 346.27 1118 346.58 1119 346.89 1120 347.20 1121 347.51 1122 347.82 1123 348.13 1124 348.44 1125 348.75 1126 349.06 1127 349.37 1128 349.68 1129 349.99 1130 350.30 1131 350.61 1132 350.92 1133 351.23 1134 351.54 1135 351.85 1136 352.16 1137 352.47 1138 352.78 1139 353.09 1140 353.40 1141 353.71 1142 354.02 1143 331.47 1144 331.76 1145 332.05 1146 332.34 1147 332.63 1148 332.92 1149 333.21 1150 333.50 1151 333.79 1152 334.08 1153 334.37 1154 334.66 1155 334.95 1156 335.24 1157 335.53 1158 335.82 1159 336.11 1160 336.40 1161 336.69 1162 336.98 1163 337.27 1164 337.56 1165 337.85 1166 338.14 1167 338.43 1168 338.72 1169 339.01 1170 339.30 1171 339.59 1172 339.88 1173 340.17 1174 340.46 1175 340.75 1176 341.04 1177 341.33 1178 341.62 1179 341.91 1180 342.20 1181 342.49 1182 342.78 1183 343.07 1184 343.36 1185 343.65 1186 343.94 1187 344.23 1188 344.52 1189 344.81 1190 345.10 1191 345.39 1192 345.68 1193 345.97 1194 346.26 1195 346.55 1196 346.84 1197 347.13 1198 347.42 1199 347.71 1200 348.00 1201 348.29 1202 348.58 1203 348.87 1204 349.16 1205 349.45 1206 349.74 1207 350.03 1208 350.32 1209 350.61 1210 350.90 1211 351.19 1212 351.48 1213 351.77 1214 352.06 1215 352.35 1216 352.64 1217 352.93 1218 353.22 1219 353.51 1220 353.80 1221 354.09 1222 354.38 1223 354.67 1224 354.96 1225 355.25 1226 355.54 1227 355.83 1228 356.12 1229 356.41 1230 356.70 1231 356.99 1232 357.28 1233 357.57 1234 357.86 1235 358.15 1236 358.44 1237 358.73 1238 359.02 1239 359.31 1240 359.60 1241 359.89 1242 360.18 1243 360.47 1244 360.76 1245 361.05 1246 361.34 1247 361.63 1248 361.92 1249 362.21 1250 362.50 1251 362.79 1252 363.08 1253 363.37 1254 363.66 1255 363.95 1256 364.24 1257 364.53 1258 364.82 1259 365.11 1260 365.40 1261 365.69 1262 365.98 1263 366.27 1264 366.56 1265 366.85 1266 367.14 1267 367.43 1268 367.72 1269 368.01 1270 368.30 1271 368.59 1272 368.88 1273 369.17 1274 369.46 1275 369.75 1276 370.04 1277 370.33 1278 370.62 1279 370.91 1280 371.20 1281 371.49 1282 371.78 1283 372.07 1284 372.36 1285 372.65 1286 372.94 1287 373.23 1288 373.52 1289 373.81 1290 374.10 1291 374.39 1292 374.68 1293 374.97 1294 375.26 1295 375.55 1296 375.84 1297 376.13 1298 376.42 1299 376.71 1300 377.00 1301 377.29 1302 377.58 1303 377.87 1304 378.16 1305 378.45 1306 378.74 1307 379.03 1308 379.32 1309 379.61 1310 379.90 1311 380.19 1312 380.48 1313 380.77 1314 381.06 1315 381.35 1316 381.64 1317 381.93 1318 382.22 1319 382.51 1320 382.80 1321 383.09 1322 383.38 1323 383.67 1324 383.96 1325 384.25 1326 384.54 1327 384.83 1328 385.12 1329 385.41 1330 385.70 1331 385.99 1332 386.28 1333 386.57 1334 386.86 1335 387.15 1336 387.44 1337 374.36 1338 374.64 1339 374.92 1340 375.20 1341 375.48 1342 375.76 1343 376.04 1344 376.32 1345 376.60 1346 376.88 1347 377.16 1348 377.44 1349 377.72 1350 378.00 1351 378.28 1352 378.56 1353 378.84 1354 379.12 1355 379.40 1356 379.68 1357 379.96 1358 380.24 1359 380.52 1360 380.80 1361 381.08 1362 381.36 1363 381.64 1364 381.92 1365 382.20 1366 382.48 1367 382.76 1368 383.04 1369 383.32 1370 383.60 1371 383.88 1372 384.16 1373 384.44 1374 384.72 1375 385.00 1376 385.28 1377 385.56 1378 385.84 1379 386.12 1380 386.40 1381 386.68 1382 386.96 1383 387.24 1384 387.52 1385 387.80 1386 388.08 1387 388.36 1388 388.64 1389 388.92 1390 389.20 1391 389.48 1392 389.76 1393 390.04 1394 390.32 1395 390.60 1396 390.88 1397 391.16 1398 391.44 1399 391.72 1400 392.00 1401 392.28 1402 392.56 1403 392.84 1404 393.12 1405 393.40 1406 393.68 1407 393.96 1408 394.24 1409 394.52 1410 394.80 1411 395.08 1412 395.36 1413 395.64 1414 395.92 1415 396.20 1416 396.48 1417 396.76 1418 397.04 1419 397.32 1420 397.60 1421 397.88 1422 398.16 1423 398.44 1424 398.72 1425 399.00 1426 399.28 1427 399.56 1428 399.84 1429 400.12 1430 400.40 1431 400.68 1432 400.96 1433 401.24 1434 401.52 1435 401.80 1436 402.08 1437 402.36 1438 402.64 1439 402.92 1440 403.20 1441 403.48 1442 403.76 1443 404.04 1444 404.32 1445 404.60 1446 404.88 1447 405.16 1448 405.44 1449 405.72 1450 406.00 1451 406.28 1452 406.56 1453 406.84 1454 407.12 1455 407.40 1456 407.68 1457 407.96 1458 408.24 1459 408.52 1460 408.80 1461 409.08 1462 409.36 1463 409.64 1464 409.92 1465 410.20 1466 410.48 1467 410.76 1468 411.04 1469 411.32 1470 411.60 1471 411.88 1472 412.16 1473 412.44 1474 412.72 1475 413.00 1476 413.28 1477 413.56 1478 413.84 1479 414.12 1480 414.40 1481 414.68 1482 414.96 1483 415.24 1484 415.52 1485 415.80 1486 416.08 1487 416.36 1488 416.64 1489 416.92 1490 417.20 1491 417.48 1492 417.76 1493 418.04 1494 418.32 1495 418.60 1496 418.88 1497 419.16 1498 419.44 1499 419.72

### natanlao commented Aug 19, 2019

 My org wanted to buy stickers. After collecting and graphing the data, we decided to buy 570 stickers (at the price point of 527).