Skip to content

Commit

Permalink
Merge pull request #3 from timskovjacobsen/develop
Browse files Browse the repository at this point in the history
First stable release
  • Loading branch information
timskovjacobsen authored Jul 25, 2021
2 parents fbdbf0a + d6199a6 commit a952ce2
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ tempCodeRunnerFile.py

# Image files
*.png
!favicon.png
*.jpeg
*.jpg

Expand Down
52 changes: 46 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Steel profiles API

API for requesting steel profile data.
API for requesting profile data for standard European construction steel profiles.

Currently supported profiles are:

Expand All @@ -11,12 +11,52 @@ Currently supported profiles are:
* IPN
* UPN

API home page: [https://nemd2m.deta.dev](https://nemd2m.deta.dev)
API home page: [steelapi.timskovjacobsen.com](http://steelapi.timskovjacobsen.com)

Endpoints:
## Endpoints

* todo
* **`GET /api/{profile_type}`**

* todo
E.g. to get data for all **HEA** profiles,
visit `steelapi.timskovjacobsen.com/api/hea`

[API Docs](https://nemd2m.deta.dev/docs) -->
* **`GET /api/{profile_type}/{dimension}`**

E.g. to get data for the profile **HEA120**, visit `steelapi.timskovjacobsen.com/api/hea/120` and you will get this response:

```shell
{
"HEA120":{
"index":1,
"name":"HEA120"
,"h":114,
"b":120,
"tw":5.0,
"tf":8.0,
"r":12,
"d":74,
"A":25.3,
"G":19.9,
"Iy":606,
"Wy":106.0,
"iiy":4.89,
"Iz":231,
"Wz":38.5,
"iiz":3.02
}
}
```

It's possible to use uppercase profile names in the URL, like HEA.
## API Docs
The swagger [API Docs](http://steelapi.timskovjacobsen/docs) for more info.
## Miscellaneous
The REST API is built with Python and the FastAPI framework. It uses Nginx in front of the API as a reverse proxy. Nginx is configured with SSL certificates to provide a secure HTTPS connection protocol via Let's Encrypt.

The API is deployed on a virtual machine running Ubuntu 20.04 hosted with Digital Ocean.

Shout-out to the [Modern APIs with FastAPI and Python](https://training.talkpython.fm/courses/details/getting-started-with-fastapi) course for inspiring this project.
Binary file added static/img/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 9 additions & 7 deletions templates/home/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,20 @@ <h1><span class="font-semi-bold">Steel Profiles REST API</span>

<div style="clear:both;"></div>
<br>
<br>
<p class="intro">
A simple REST API for requesting data for common European steel profiles.<br>
<br>
Check out the <a href="http://steelapi.timskovjacobsen.com/docs/">Docs</a> for more information.<br>
<br>
</p>

<p>

<h2>Endpoints</h2>
<ul>
<li>
<strong><code>GET
/api/{profile_type}</code></strong><br>
E.g. to get data for all <strong>HEA</strong> profiles, visit <a href="/api/HEA" target="_blank"><strong>GET
/api/HEA</strong></a><br>
<br>
</li>

<li>
Expand All @@ -35,10 +31,8 @@ <h2>Endpoints</h2>
E.g. to get data for the profile <strong>HEA120</strong>, visit <a href="/api/HEA/120"
target="_blank"><strong>GET
/api/HEA/120</strong></a><br>
<br>
</li>
</ul>
</p>

<h2>Units</h2>

Expand All @@ -64,7 +58,15 @@ <h2>Units</h2>

<h2>Supported profiles</h2>

<p>For now, the supported profiles are HEA, HEB, HEM, IPE, IPN and UPN.</p>
<p>For now, the supported profiles are
<a href="/HEA" target="_blank"> HEA</a>,
<a href="/HEB" target="_blank"> HEB</a>,
<a href="/HEM" target="_blank"> HEM</a>,
<a href="/IPE" target="_blank"> IPE</a>,
<a href="/IPN" target="_blank"> IPN</a> and
<a href="/UPN" target="_blank"> UPN</a>
.
</p>

<div style="margin-bottom:50px">
<h2>References</h2>
Expand Down
2 changes: 1 addition & 1 deletion views/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def uppercase_profile_endpoint_template(request: Request):
{"request": request, "df_html": df_html, "profile_type": profile_type},
)

@router.get(f"/{profile_type.lower()}")
@router.get(f"/{profile_type.lower()}", include_in_schema=False)
def lowercase_profile_endpoint_template(request: Request):
return uppercase_profile_endpoint_template(request)

Expand Down

0 comments on commit a952ce2

Please sign in to comment.