herissondev / vinted-api-wrapper

This is a simple python module to interact with the vinted api with ease.
MIT License
31 stars 9 forks source link

Error since today #7

Open RBenhamza opened 2 years ago

RBenhamza commented 2 years ago

Hello there ! First of all, thank you for this wrapper, it's been very usefull for me and my friends. Then I made a bot that scan some page basing on the search tag you give him and then play a sound when a new article is posted on it, here is the code for the first request I send: image

And everything was fine until today, but now, when I to use it, I have this error : image

Could you please tell me if something is wrong or how to fix it ? thank you

Felicien410 commented 2 years ago

yess same ! thanks for all !

reusteur73 commented 1 year ago

Hi, I come to bring my personal experience.

I just noticed that I can run the following program without error:

from pyVinted import Vinted

def get_p():
    vinted = Vinted()

    items = vinted.items.search("https://www.vinted.fr/vetement?order=newest_first&currency=EUR",10,1)
    for item in items:
        vinted_id = item.id
        title = item.title
        photo = item.photo
        brand = item.brand_title
        price = item.price
        url = item.url
        print(url,title, price, brand)
get_p()

Only with python3.6 When I run it with python3.9+ I get the same error as you.

Here are the outputs I have:

C:/Users/maloa/AppData/Local/Programs/Python/Python39/python.exe c:/Users/maloa/Documents/scrapeVIN-master/test.py
Traceback (most recent call last):
  File "c:\Users\maloa\Documents\scrapeVIN-master\test.py", line 16, in <module>
    get_prods()
  File "c:\Users\maloa\Documents\scrapeVIN-master\test.py", line 7, in get_prods
    items = vinted.items.search("https://www.vinted.fr/vetement?order=newest_first&currency=EUR",10,1)
  File "C:\Users\maloa\AppData\Local\Programs\Python\Python39\lib\site-packages\pyVinted\items\items.py", line 34, in search
    raise err
  File "C:\Users\maloa\AppData\Local\Programs\Python\Python39\lib\site-packages\pyVinted\items\items.py", line 25, in search
    response.raise_for_status()
  File "C:\Users\maloa\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\models.py", line 953, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://www.vinted.fr/api/v2/catalog/items?search_text=&catalog_ids=&color_ids=&brand_ids=&size_ids=&material_ids=&status_ids=&country_ids=&city_ids=&is_for_swap=&currency=EUR&price_to=&price_from=&page=1&per_page=10&order=newest_first
PS C:\Users\maloa\Documents\scrapeVIN-master>
b:/Python/Python36_64/python.exe c:/Users/maloa/Documents/scrapeVIN-master/test.py
Cookies set!
https://www.vinted.fr/dzieci/gry-i-zabawki/zabawki-kuchenne/2128719857-forno-con-suoni-e-timer Forno con suoni e timer  10.0 Vintage
https://www.vinted.fr/dzieci/ubrania-dla-dziewczynek/pizamy/jednoczesciowe/2128719850-lot-pyjama-coton Lot Pyjama coton  4.0 Kiabi
https://www.vinted.fr/men/clothes/activewear/tracksuits/2128719806-greyblack-trapstar-tracksuit-size-s Grey/black trapstar tracksuit size S  68.0 Trapstar
https://www.vinted.fr/divertissement/livres/litterature-and-fiction/policiers-and-thrillers/2128719753-libro-alessandro-davenia Libro Alessandro D’avenia 8.0
https://www.vinted.fr/kobiety/ubrania/sukienki/krotkie-sukienki/2128719732-primark-knight-wear-dress Primark knight wear dress 5.0 Primark
https://www.vinted.fr/dzieci/ubranka-dla-chlopcow/swetry-i-bluzy/zapinane-swetry/2128719728-gilet-chaud-perou Gilet chaud Pérou  12.0 perou
https://www.vinted.fr/kobiety/ubrania/topy-koszulki-i-t-shirty/inne/2128719725-haut-marron haut marron 2.0 sans marque
https://www.vinted.fr/dzieci/ubrania-dla-dziewczynek/dziew-ubranka-niemowlece/zestawy/2128719654-robe Robe 👗  1.0 Tape à l'œil
https://www.vinted.fr/men/clothes/jumpers-and-sweaters/hoodies-and-sweatshirts/2128719651-pull-en-maille pull en maille 8.0 Zara

Have a great day !

SajidZakaria commented 1 year ago

Any update on this?

reusteur73 commented 1 year ago

Yes, I'm pretty sure it's related to the python version. I tested under several environments (Windows and Debian), on both I noticed that python3.6.6 worked. Every time I run the script with higher python (I tested with python3.9 and python3.10) (on both environments) it didn't work, and returned me the error quoted above. I think it is imperative to use python3.6.6 or lower (not tested) for the script to work. I don't have a solution on my side to make it work on higher versions of python. Have a great day.

herissondev commented 1 year ago

I guys ! Sorry for not replying I was on vacation. I will look into this in the following week. I think the error is due to python request "saving" some infos which is probably making vinted blocking us.

massiou commented 1 year ago

I have just tested with python3.7.6 and request==2.19.1 and it worked fine !

sunr4y commented 1 year ago

any updates?

sunr4y commented 1 year ago

@aime-risson

jantongo commented 1 year ago

Works OK with python 3.9.2 and requests==2.19.1. Failed with newer requests (2.23.1 maybe).

jantongo commented 1 year ago

Updated to python 3.11.1 and still worked.

Then upgraded requests to 2.28.1. Still worked. Then upgraded charset-normalizer to 2.1.1. Still worked. Then upgraded idna to 3.4. Still worked. Then upgraded urllib3 to 1.26.13. And crashed!

The most recent working version for urllib3 is 1.24.3.

2IIZ commented 1 year ago

pip install --force-reinstall -v "urllib3 ==1.21.1" worked like a charm