Giglium / vinted_scraper

A very simple Python package that scrapes the Vinted website to retrieve information about its items.
MIT License
13 stars 2 forks source link

Error: Cannot perform API call to endpoint /catalog/items, error code: 504 #42

Closed segisito closed 3 months ago

segisito commented 5 months ago

Describe the bug

I am using it to list vinted items in a bot, it has always worked correctly in a 1 minute loop that I have it running 24/7 but today it is constantly warning me several times an hour or every 2 hours the error when sending a package to vinted and it does not receive it giving error 504, could you know why? I have extended the time to every minute and a half to make the request to not overload the requests but it still fails.

I have tried to debug it but I can't find the problem.

Steps to reproduce

While executing

Expected behavior

Error: Cannot perform API call to endpoint /catalog/items, error code: 504

Example

async def scrape_and_send_message(): global processed_item_ids

baseurl = 'https://www.vinted.es'
vinted_scraper = VintedScraper(baseurl)

# Buscar todos los artículos Tamagotchi
params = {"search_text": "Tamagotchi", "order": "newest_first"}
items = vinted_scraper.search(params)

if items:
    item = items[0]

    if item.id not in processed_item_ids:
        # Obtener el nombre, precio, enlace y usuario del nuevo Tamagotchi
        price = item.price
        precio = str(item.price)
        item_link = f"{baseurl}/items/{item.id}-{item.description}?referrer=catalog"
        descripcion = item.title

Tell us about your environment

Giglium commented 5 months ago

Hi, I've tried your code and it's working fine. Also, a 504 can be Vinted that is down or having some issues, sometimes happened. Keep care, if you perform too many requests to Vinted you will receive a 429 status code, so it probably is not your 1-minute loop that is the root cause.

Are you using any proxy?

Giglium commented 5 months ago

Very interesting. I've run some tests for a pull request and I see the 504 error: https://github.com/Giglium/vinted_scraper/actions/runs/8125855118/job/22208905313?pr=44

The code and the test haven't changed (I've modified a GitHub Action) also re-running the failed job all tests passed. I start to think that this is a Vinted issue and not your issue.

Giglium commented 3 months ago

I'm not able to reproduce this issues anymore. Probably, it was a Vinted issue and not your issue.