-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
138 additions
and
31 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
.. role:: hidden | ||
:class: hidden-section | ||
|
||
Parse Address With Our Out-Of-The-Box API | ||
========================================= | ||
|
||
We also offer an out-of-the-box RESTAPI to parse addresses using FastAPI. | ||
|
||
Installation | ||
************ | ||
|
||
First, ensure that you have Docker Engine and Docker Compose installed on your machine. | ||
If not, you can install them using the following documentations in the following order: | ||
|
||
1. `Docker Engine <https://docs.docker.com/engine/install/>`_ | ||
2. `Docker Compose <https://docs.docker.com/compose/install/>`_ | ||
|
||
Once you have Docker Engine and Docker Compose installed, you can run the following command to start the FastAPI application: | ||
|
||
.. code-block:: sh | ||
docker compose up app | ||
Sentry | ||
****** | ||
|
||
Also, you can monitor your application usage with `Sentry <https://sentry.io>`_ by setting the environment variable ``SENTRY_DSN`` to your Sentry's project | ||
DSN. There is an example of the ``.env`` file in the project's root named ``.env_example``. You can copy it using the following command: | ||
|
||
.. code-block:: sh | ||
cp .env_example .env | ||
Request Examples | ||
---------------- | ||
|
||
Once the application is up and running and port ``8000`` is exported on your localhost, you can send a request with one | ||
of the following methods: | ||
|
||
cURL POST request | ||
~~~~~~~~~~~~~~~~~ | ||
|
||
.. code-block:: shell | ||
curl -X POST --location "http://127.0.0.1:8000/parse/bpemb-attention" --http1.1 \ | ||
-H "Host: 127.0.0.1:8000" \ | ||
-H "Content-Type: application/json" \ | ||
-d "[ | ||
{\"raw\": \"350 rue des Lilas Ouest Quebec city Quebec G1L 1B6\"}, | ||
{\"raw\": \"2325 Rue de l'Université, Québec, QC G1V 0A6\"} | ||
]" | ||
Python POST request | ||
~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. code-block:: python | ||
import requests | ||
url = 'http://localhost:8000/parse/bpemb' | ||
addresses = [ | ||
{"raw": "350 rue des Lilas Ouest Quebec city Quebec G1L 1B6"}, | ||
{"raw": "2325 Rue de l'Université, Québec, QC G1V 0A6"} | ||
] | ||
response = requests.post(url, json=addresses) | ||
parsed_addresses = response.json() | ||
print(parsed_addresses) |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
black==23.3.0 | ||
black==23.9.1 | ||
pylint==2.16.2 | ||
pylint-django[with_django]==2.5.3 | ||
pre-commit==3.3.3 |