Skip to content

Wallapop API

TODO#

  • [ ] Find user info by ID. @2021-12-18

Search API#

  • @2021-12-15
  • From z0r3f/wallbot
  • problems: cannot select location
  • cannot see outdated items
  • URL sample [https://api.wallapop.com/api/v3/general/search?keywords=3080TI&min_sale_price=120&max_sale_price=300]
  • Code
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import requests

print("starting")
SEARCH_URL_BASE = "https://api.wallapop.com/api/v3/general/search/"


def gen_url(keywords, category_ids, min_price, max_price, dist, order):

    url = SEARCH_URL_BASE
    url += "?keywords="
    url += "+".join(keywords.split(" "))
    url += "&time_filter=today"
    if category_ids is not None:
        url += "&category_ids="
        url += category_ids
    if min_price is not None:
        url += "&min_sale_price="
        url += min_price
    if max_price is not None:
        url += "&max_sale_price="
        url += max_price
    if dist is not None:
        url += "&dist="
        url += dist
    if order is not None:
        url += "&order_by="
        url += order
    return url


# get url content
def get_url_content(url):
    print("getting url content")
    print(f"{url}")
    headers = {
        "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36",
    }
    response = requests.get(url, headers=headers)
    return response.content


print(get_url_content(gen_url("", "", "", "", "", "")))