venthur / immoscrapy

Scrape Immobilienscout24 data using Python
MIT License
6 stars 1 forks source link

Getting response 405 #13

Open Lama09 opened 2 years ago

Lama09 commented 2 years ago

Hi Bastian, I use the module daly since a while to grab the latest offers. Today I do recieved a 405 response from the post() request. Any idea what is going wrong.

ult = immoscrapy.query('de', 'sachsen', 'chemnitz', 'HOUSE_BUY', price=900000)

"POST /Suche/de/sachsen/chemnitz/haus-kaufen?sorting=2&price=900000 HTTP/1.1" 405 0

BR Lama

ralf-koenig commented 2 years ago

I also get an HTTP 405 on the command from the docs:

$ python cli.py buy-apartment --country de --region berlin --price 100000-800000 --numberofrooms 5- 2022-06-23 22:53:09,171 INFO immoscrapy Using URL: https://www.immobilienscout24.de/Suche/de/berlin/wohnung-kaufen?sorting=2&price=100000-800000&numberofrooms=5- 2022-06-23 22:53:09,175 DEBUG urllib3.connectionpool Starting new HTTPS connection (1): www.immobilienscout24.de:443 2022-06-23 22:53:09,306 DEBUG urllib3.connectionpool https://www.immobilienscout24.de:443 "POST /Suche/de/berlin/wohnung-kaufen?sorting=2&price=100000-800000&numberofrooms=5- HTTP/1.1" 405 0 2022-06-23 22:53:09,307 WARNING immoscrapy Search returned 0 results. No results.

So I always get zero results. Does this scraper (which looks fairly recent) work anymore?

Best regards, Ralf

ralf-koenig commented 2 years ago

This is output of pytest:

C:\Users\<username>\PycharmProjects\immoscrapy\venv\Scripts\python.exe "C:\Program Files\JetBrains\PyCharm 2021.2.3\plugins\python\helpers\pycharm\_jb_pytest_runner.py" --path C:/Users/<username>/PycharmProjects/immoscrapy/tests/test_immoscrapy.py

Testing started at 00:47 ...
Launching pytest with arguments C:/Users/<username>/PycharmProjects/immoscrapy/tests/test_immoscrapy.py --no-header --no-summary -q in C:\Users\<username>\PycharmProjects\immoscrapy\tests

============================= test session starts =============================
collecting ... collected 6 items

test_immoscrapy.py::test_query_berlin[HOUSE_BUY-HOUSE_BUY] FAILED        [ 16%]
tests\test_immoscrapy.py:5 (test_query_berlin[HOUSE_BUY-HOUSE_BUY])
real_estate_type = 'HOUSE_BUY'
return_type = <class 'immoscrapy.immoscrapy.HOUSE_BUY'>

    @pytest.mark.parametrize(
        "real_estate_type, return_type",
        [
            ('HOUSE_BUY', immoscrapy.HOUSE_BUY),
            ('HOUSE_RENT', immoscrapy.HOUSE_RENT),
            ('APARTMENT_BUY', immoscrapy.APARTMENT_BUY),
            ('APARTMENT_RENT', immoscrapy.APARTMENT_RENT),
         ]
    )
    def test_query_berlin(real_estate_type, return_type):
        result = immoscrapy.query('de', 'berlin', 'berlin', real_estate_type)
>       assert isinstance(result[0], return_type)
E       IndexError: list index out of range

test_immoscrapy.py:17: IndexError
FAILED      [ 33%]
tests\test_immoscrapy.py:5 (test_query_berlin[HOUSE_RENT-HOUSE_RENT])
real_estate_type = 'HOUSE_RENT'
return_type = <class 'immoscrapy.immoscrapy.HOUSE_RENT'>

    @pytest.mark.parametrize(
        "real_estate_type, return_type",
        [
            ('HOUSE_BUY', immoscrapy.HOUSE_BUY),
            ('HOUSE_RENT', immoscrapy.HOUSE_RENT),
            ('APARTMENT_BUY', immoscrapy.APARTMENT_BUY),
            ('APARTMENT_RENT', immoscrapy.APARTMENT_RENT),
         ]
    )
    def test_query_berlin(real_estate_type, return_type):
        result = immoscrapy.query('de', 'berlin', 'berlin', real_estate_type)
>       assert isinstance(result[0], return_type)
E       IndexError: list index out of range

test_immoscrapy.py:17: IndexError
FAILED [ 50%]
tests\test_immoscrapy.py:5 (test_query_berlin[APARTMENT_BUY-APARTMENT_BUY])
real_estate_type = 'APARTMENT_BUY'
return_type = <class 'immoscrapy.immoscrapy.APARTMENT_BUY'>

    @pytest.mark.parametrize(
        "real_estate_type, return_type",
        [
            ('HOUSE_BUY', immoscrapy.HOUSE_BUY),
            ('HOUSE_RENT', immoscrapy.HOUSE_RENT),
            ('APARTMENT_BUY', immoscrapy.APARTMENT_BUY),
            ('APARTMENT_RENT', immoscrapy.APARTMENT_RENT),
         ]
    )
    def test_query_berlin(real_estate_type, return_type):
        result = immoscrapy.query('de', 'berlin', 'berlin', real_estate_type)
>       assert isinstance(result[0], return_type)
E       IndexError: list index out of range

test_immoscrapy.py:17: IndexError
FAILED [ 66%]
tests\test_immoscrapy.py:5 (test_query_berlin[APARTMENT_RENT-APARTMENT_RENT])
real_estate_type = 'APARTMENT_RENT'
return_type = <class 'immoscrapy.immoscrapy.APARTMENT_RENT'>

    @pytest.mark.parametrize(
        "real_estate_type, return_type",
        [
            ('HOUSE_BUY', immoscrapy.HOUSE_BUY),
            ('HOUSE_RENT', immoscrapy.HOUSE_RENT),
            ('APARTMENT_BUY', immoscrapy.APARTMENT_BUY),
            ('APARTMENT_RENT', immoscrapy.APARTMENT_RENT),
         ]
    )
    def test_query_berlin(real_estate_type, return_type):
        result = immoscrapy.query('de', 'berlin', 'berlin', real_estate_type)
>       assert isinstance(result[0], return_type)
E       IndexError: list index out of range

test_immoscrapy.py:17: IndexError

PASSED                 [ 83%]PASSED                          [100%]

test_immoscrapy.py::test_query_berlin[HOUSE_RENT-HOUSE_RENT] 
test_immoscrapy.py::test_query_berlin[APARTMENT_BUY-APARTMENT_BUY] 
test_immoscrapy.py::test_query_berlin[APARTMENT_RENT-APARTMENT_RENT] 
test_immoscrapy.py::test_query_raises_value_error 
test_immoscrapy.py::test_regression_gh_8 

========================= 4 failed, 2 passed in 1.40s =========================

Process finished with exit code 1