rename UNSHORTENERS
This commit is contained in:
parent
4d01e8812d
commit
4296afee69
@ -5,7 +5,7 @@ from fastapi import FastAPI
|
|||||||
from fastapi.middleware.cors import CORSMiddleware
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
from unshorteners import unshorten_twitter
|
from unshorteners import unshorten_twitter
|
||||||
|
|
||||||
UNSHORTENERS = {
|
UNSHORTEN = {
|
||||||
't.co': unshorten_twitter
|
't.co': unshorten_twitter
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ async def receive_url(url: Optional[str] = None):
|
|||||||
return {"error": "no url provided"}
|
return {"error": "no url provided"}
|
||||||
|
|
||||||
domain = urlparse(url).netloc
|
domain = urlparse(url).netloc
|
||||||
if domain not in UNSHORTENERS:
|
if domain not in UNSHORTEN:
|
||||||
return {"error": f"cannot unshorten {domain}"}
|
return {"error": f"cannot unshorten {domain}"}
|
||||||
|
|
||||||
return UNSHORTENERS[domain](url)
|
return UNSHORTEN[domain](url)
|
||||||
|
Loading…
Reference in New Issue
Block a user