Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea/
.bash_history
.env
.gitconfig
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pyenv local 3.10.0
8 changes: 8 additions & 0 deletions Zoom-Discussion.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
In python project you don't commit dependencies to the project
so typically this would be required: pip install -r requirements.txt

# TODOs
1. Why does installing packages fail????
2. Do we need a .python-version file or a pyproject.yaml??
3. Consistent build process
4. Readme for actions container or fwd?
24 changes: 24 additions & 0 deletions example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Strongly vs Dynamic Languages
# Python is STRONGLY typed DYNAMIC language

# https://www.bairesdev.com/blog/static-vs-dynamic-typing/

# STATIC vs DYNAMIC
# For STATIC languages your IDE/build it will complain at COMPILE time if you're doing some
# kind of operand on incompatible types
# for DYNAMIC languages type checking is done at RUNTIME

# STRONG vs WEAKLY type
# A programing language that is strongly typed can either by dynamic or static
# Weakly-typed languages make conversions between unrelated types implicitly;
# whereas, strongly-typed languages don’t allow implicit conversions between unrelated types.

# JAVASCRIPT it is weakly typed and dynamic this will run without a single fucking error
# value = 21;
# value = value + "dot";
# console.log(value);
# 21dot

myName = "Lou " + 3 # We get a squiggle because we don't allow implicit type conversion

print(myName)
Binary file added img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 7 additions & 1 deletion webapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,19 @@ def shorten_url():
response = prepare_response(short_url)
return response

def save_url_to_database(short_url, long_url):

# example of a default parameter, required arguments must go at the beginning of the argument list
def save_url_to_database(long_url, short_url="default"):
conn = get_db_connection()
conn.execute('INSERT INTO urls (short_url, long_url) VALUES (?, ?)',
(short_url, long_url))
conn.commit()
conn.close()


# save_url_to_database(long_url="long_url") - example of using name parameters


def prepare_response(short_url):
return jsonify(short_url=os.getenv('REDIRECT_URL') + short_url)

Expand Down