This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Instantiate the client with an endpoint. | |
endpoint="https://renovationreserve.myshopify.com/admin/api/2023-07/graphql.json" | |
# Provide a GraphQL query | |
query = """ | |
query ProductsBySku($skuFilter: String!){ | |
products(first: 1, query: $skuFilter) { | |
edges { | |
node { | |
id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# We're using a baseball analogy. E.g. A mailer gets 3 strikes per out and 3 outs in the first 9 pitches. All the limits are defined below | |
# inputs | |
ThresholdProb <- 0.03 # this is the minimum probability we need to be profitable for the business | |
num_simulations <- 1000 | |
strikes_per_out = 3 | |
outs_limit = 1 | |
# The game starts here! | |
mailers_per_pitch = round(1 / ThresholdProb, 0) | |
mailers_per_simulation <- 1 / ThresholdProb * strikes_per_out * outs_limit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from os import environ | |
import requests | |
from requests.auth import HTTPBasicAuth | |
def create_close_params(starting_year, ending_year): | |
def generate_first_day_of_the_month(starting_year, ending_year): | |
first_day_of_the_month = [] | |
for year in range(starting_year, ending_year + 1): | |
for month in range(1, 13): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from os import environ | |
import requests | |
from requests.auth import HTTPBasicAuth | |
CLOSE_API_KEY = environ.get("CLOSE_API_KEY", "") | |
BASE_URL = "https://api.close.com/api/v1/lead/" | |
PARAMS = {"query": """(original_lead_status:"stat_pdBqiRfX6DrpDrE8v320qT2tCSSNURza5cv8aSWxdcp" and created >= "2020-06-01 00:00:00" and created <= "2020-06-30 23:59:59") or lead_status_change(new_status:"stat_pdBqiRfX6DrpDrE8v320qT2tCSSNURza5cv8aSWxdcp" and date >= "2020-06-01 00:00:00" and date <= "2020-06-30 23:59:59")"""} | |
resp = requests.get(BASE_URL, params=PARAMS, auth=HTTPBasicAuth(CLOSE_API_KEY, "")) | |
num_of_results = resp.json()["total_results"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import calendar | |
def get_first_and_last_day_for_a_year(year_num): | |
first_and_last_dates = [] | |
first_and_last_dates_formatted = [] | |
for i in range(1, 13): | |
_, num_days = calendar.monthrange(year_num, i) | |
first_day = datetime.date(year_num, i, 1) | |
last_day = datetime.date(year_num, i, num_days) | |
first_and_last_dates.append([first_day, last_day]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Input | |
{ | |
"starting_url": "https://www.landwatch.com/Oklahoma_land_for_sale/Osage_County/Land", | |
"bucket": "landtoolsai" | |
} | |
## Output | |
Request: /scrape_landwatch | |
Status: 502 | |
Latency: 1111 ms |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
import csv | |
import io | |
import os | |
from PIL import Image, ImageDraw, ImageFont | |
import pdb | |
def image_test(): | |
def load_file_from_s3(*, bucket, key): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import os | |
import requests | |
CENSUS_API_KEY = os.environ.get("CENSUS_API_KEY", "") | |
CENSUS_SURNAME_URL = "https://api.census.gov/data/2010/surname" | |
params = { | |
"key": CENSUS_API_KEY, | |
"get": "NAME,COUNT", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def add_string_breaks(string): | |
list_words_in_str = string.split() | |
str_standard_whitespace = " ".join(list_words_in_str) | |
count_words_in_str = len(list_words_in_str) | |
slogan_lines = [] | |
i = 0 | |
possible_words_in_line = count_words_in_str | |
while i < possible_words_in_line: | |
text_already_newline = " ".join(slogan_lines) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
�E�H�@#t����o���ُ���l%�|`��t�q�d=&#�Q"K^I����߯�U�TV��M�LhDo��ƿ����w�͟����L� | |
<�1�7��-^�?���ψ=��6�L�.n2fF��NDr$��-��f�uWqt �0-�Sh0� | |
��`NPC��8���w-'�߰�@ԊP�HRhU�hR �2�W��}6�)!���_� ³}y0�h�Q!��ȵ! ����a������yڏ��~�*' ��# \���~2�����l6Ȑ29 | |
�\$ݧC�=:S#�ca�b9����.�� ��NL�Z�-H��g ��&���㘘�K��a�ﮞ.�5?�|��W��yqr��9������ | |
�b�b8G��}�Y"� 2(���-�q�W^��O�)�]���(���<M(|���8���sY&�C�˼�\Qu\+����/���`Myb���Q� | |
<�t��ę:{Q�'^\?}��`]�9vr��4��( ��������P��e����cL���l�o�����1�q��:��> | |
�G_�="�wd8�:����6�Ћjp1@�����5���e�>�&�p k��r�*v�CZ����a�Nͽ��3�}�˟ ߽�O|��͕�=2�Q' | |
<áo�SǬa��,���pb�$XQb���<�O������-��q�4Vt�䣀��6��.���P�îV�����Q2��S���I��P�i&A�Gd�.����`x�M[�����> | |
%����Y�u�k�'��p�kFs�9G���A0N� �I���(�|U�ÕFD��E���六\��� | |
�v�D��Y������ewI�^�HPE �|��,�#k��I?qiK�;�zoCr+#���0����%A��1�V1LnU�I���x��yq������.�i��2�H�sX�r��5��q����"3T���n��L�\�O |
NewerOlder