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: 0 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,3 @@ jobs:
- name: Format code
run: |
make format

62 changes: 62 additions & 0 deletions CopyToGitHub.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": [],
"authorship_tag": "ABX9TyPHJSVlBiqzKGsES92bvEWZ",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/github/GrzegorzDjango/functions-from-zero/blob/main/CopyToGitHub.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "GbU-9zp544td",
"outputId": "f2219019-2f51-40e0-891b-49f270590a99"
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"I was made in colab!\n"
]
}
],
"source": [
"print(\"I was made in colab!\")"
]
},
{
"cell_type": "code",
"source": [],
"metadata": {
"id": "4vATIZBg48_E"
},
"execution_count": null,
"outputs": []
}
]
}
1 change: 1 addition & 0 deletions fire-cli.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import fire
from mylib.bot import scrape


if __name__ == "__main__":
fire.Fire(scrape)
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Wiki(BaseModel):

@app.post("/wiki")
async def scrape_story(wiki: Wiki):
result = scrape(name=wiki.name)
result = scrape(name=wiki.name, length=1)
payload = {"wikipage": result}
json_compatible_item_data = jsonable_encoder(payload)
return JSONResponse(content=json_compatible_item_data)
Expand Down
2 changes: 1 addition & 1 deletion mylib/bot.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import wikipedia

def scrape(name="Microsoft", length=1):
def scrape(name, length):
result = wikipedia.summary(name, sentences=length)
return result
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ ipython==8.1.1
fire==0.4.0
fastapi==0.75.0
pydantic==1.9.0
uvicorn==0.17.6
uvicorn==0.17.6
click==8.0.2
Loading