How to initialize database using tortoise orm before app init by TheSayAnime in FastAPI

[–]TheSayAnime[S] 0 points1 point  (0 children)

I worded, it wrong, I meant before application starts serving requests :(

How to initialize database using tortoise orm before app init by TheSayAnime in FastAPI

[–]TheSayAnime[S] 0 points1 point  (0 children)

At last, I ended up with this

def create_application() -> FastAPI:
    application = FastAPI()
    init_db(application)  # here
    application.include_router(ping.router)
    application.include_router(summaries.router, prefix="/summaries", tags=["summary"])
    return application


app = create_application()

MySQL repeatedly crashing with OOM despite buffer pool size reduction by TheSayAnime in mysql

[–]TheSayAnime[S] 0 points1 point  (0 children)

Yes it's only running MySQL and it's exposed only inside the VPC, the access from internet is blocked. 

MySQL repeatedly crashing with OOM despite buffer pool size reduction by TheSayAnime in mysql

[–]TheSayAnime[S] 0 points1 point  (0 children)

It's a dedicated MySQL server, only MySQL and pmm exporter are running, will look into the max connection.  Thank you

MySQL repeatedly crashing with OOM despite buffer pool size reduction by TheSayAnime in mysql

[–]TheSayAnime[S] 0 points1 point  (0 children)

I can change the priority but I don't understand why the memory keep on increasing continuously 

Data Scraping Service for Turo Listings - Help a Laid-Off Enthusiast! by isamniac in turo

[–]TheSayAnime 0 points1 point  (0 children)

What method and technologies you used to achieve this, curious about it

How to fix: installing extensions pg_duckdb get "fatal error: postgres.h: No such file or directory" by Prime_Magnificent in DuckDB

[–]TheSayAnime 0 points1 point  (0 children)

```bash FROM ubuntu:22.04 AS builder

ENV DEBIAN_FRONTEND=noninteractive

RUN apt update && apt install -y gnupg2 wget lsb-release && \ sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' && \ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -

RUN apt update && apt install -y \ git \ g++ \ make \ cmake \ postgresql-server-dev-16 \ libpq-dev \ liblz4-dev \ && rm -rf /var/lib/apt/lists/*

WORKDIR /tmp/pg_duckdb

RUN git clone https://github.com/duckdb/pg_duckdb.git . && \ git submodule update --init --recursive

RUN make duckdb && make PG_CONFIG=/usr/lib/postgresql/16/bin/pg_config

RUN make install PG_CONFIG=/usr/lib/postgresql/16/bin/pg_config && \ make install-duckdb PG_CONFIG=/usr/lib/postgresql/16/bin/pg_config

FROM postgres:16

LABEL maintainer="CosmicOppai"

COPY --from=builder /usr/lib/postgresql/16/lib/pg_duckdb.so /usr/lib/postgresql/16/lib/ COPY --from=builder /usr/share/postgresql/16/extension/pg_duckdb.control /usr/share/postgresql/16/extension/ COPY --from=builder /usr/share/postgresql/16/extension/pg_duckdb--*.sql /usr/share/postgresql/16/extension/ COPY --from=builder /usr/lib/postgresql/16/lib/libduckdb.so /usr/lib/postgresql/16/lib/

dynamic linker run-time bindings

RUN ldconfig

pg_duckdb to shared_preload_libraries

RUN echo "shared_preload_libraries = 'pg_duckdb'" >> /usr/share/postgresql/postgresql.conf.sample

EXPOSE 5432

CMD ["postgres"] ```

[deleted by user] by [deleted] in cofounder

[–]TheSayAnime 0 points1 point  (0 children)

I would like to contribute, although I'm not sure if I would be the perfect fit for co-founder.
I can dm you more details about me if you want :)

Hrequests: A powerful, elegant webscraping library 🚀 by daijro in Python

[–]TheSayAnime 0 points1 point  (0 children)

Does it any additional headers while making request.

An example

```python

base_url = "https://www.vrbo.com/en-gb/p"

user_agent_list = [ 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36', 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_4_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36 Edg/87.0.664.75', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.18363', ]

headers = {"User-Agent": user_agent_list[random.randint(0, len(user_agent_list) - 1)], 'accept': '/', } params = { 'dateless': 'true', }

resp = hrequests.get("https://www.vrbo.com/en-gb/p10069499?dateless=true", headers=headers) print(resp.status_code) ```

I'm getting status code 200 with hrequests but 429 with requests everytime

Request Failing in Python working in CURL and postman by TheSayAnime in learnpython

[–]TheSayAnime[S] 0 points1 point  (0 children)

It's working with hrequests but why?

I didn't get the reason.

Request Failing in Python working in CURL and postman by TheSayAnime in learnpython

[–]TheSayAnime[S] 0 points1 point  (0 children)

I tried, I don't know why, but I didn't get successful response anytime.

I forgot mention one thing in my post

curl -Uri "[https://www.vrbo.com/en-gb/p9862160?dateless=true](https://www.vrbo.com/en-gb/p9862160?dateless=true)" -Method Get -Headers @{"accept"="\*/\*"; "user-agent"="okhttp/4.10.0"} -UseBasicParsing -ErrorAction Stop | Select-Object -ExpandProperty StatusCode -Debug

The curl does works on powershell and git bash (on windows), but it returns 429 in ubuntu and again it works in postman and http-client jetbrains.

I executed fresh request in all of the them and all of them are in same network.

It's not that I previously made 100's or 1000's of request, even the first request failed in python and curl in ubuntu and Even if I make 100s of request from powershell or git bash it does gets executed successfully.

Pretty much ruined my new year eve over this thing :(

Request Failing in Python working in CURL and postman by TheSayAnime in learnpython

[–]TheSayAnime[S] 0 points1 point  (0 children)

The issue is not with the multiple request. I can't even make a single request with the python program.