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
from aiohttp import ClientSession | |
from enum import Enum, auto | |
import asyncio | |
class InvalidResponse(Exception): | |
"""Error class for invalid responses.""" | |
pass | |
class InvalidInput(Exception): | |
"""Error class for invalid inputs.""" |
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
from requests import get | |
from bs4 import BeautifulSoup | |
class CPPReference: | |
def __init__(self, keyword: str) -> None: | |
self.keyword = keyword | |
self.url = f"https://en.cppreference.com/w/cpp/keyword/{keyword}" | |
def request(self): | |
self.response = get(self.url, headers={"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:89.0) Gecko/20100101 Firefox/89.0"}) | |
if self.response.status_code != 200: |
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
from nowpayments import ( | |
currency, | |
exchanges, | |
Plugins, | |
Payments, | |
NowPaymentsAPI, | |
GetPaymentContext | |
) | |
from nowpayments.dataclasses import IPNCompatibleResponse |
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
import geopy, haversine as hs | |
from fastapi import FastAPI | |
app = FastAPI() | |
@app.get("/get/locationDistance") | |
async def distanceCalc(loc1: str, loc2: str): | |
locator = geopy.Nominatim(user_agent="MacOS 13.5;") | |
location: geopy.Location = (locator.geocode(loc1)) | |
location2: geopy.Location = (locator.geocode(loc2)) | |
point1 = (location.latitude, location.longitude) |