title: Akamai sensor data generator for a valid _abck cookie on post request (Python)
body: <p>So I'm trying to do an auto checkout on a website but I keep getting blocked because I cant get a valid _abck cookie.
  I've seen on some websites that people pay so coders give them the sensor data generator, I can't afford that so I came here in search for some advice in how to code this generator.</p>
  <p>First I've to crate a post request with the sensor data as payload, this one will set the valid _abck cookie.
  Then I've to create another post request with the _abck cookie and some more to call the checkout and get the paypal url</p>
  <p>Website: <a href="http://www.zalando.com" rel="nofollow noreferrer">www.zalando.com</a></p>
  <p>API: <a href="https://opensource.zalando.com/restful-api-guidelines/" rel="nofollow noreferrer">https://opensource.zalando.com/restful-api-guidelines/</a></p>
  <pre><code>import pickle, requests
  
  from bs4 import BeautifulSoup
  
  
  s = requests.session()
  
  headers = {
      'Authority': 'www.zalando.es',
      'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
      &quot;Accept-Encoding&quot;: &quot;gzip, deflate, br&quot;,
      'Accept-Language': 'es-ES,es;q=0.9',
      'Referer': 'https://www.zalando.es/checkout/address',
      &quot;Cache-Control&quot;: &quot;no-cache&quot;,
      'Upgrade-Insecure-Requests': '1',
      'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36'
  }
  
  s.headers.update(headers)
  
  #loading previous zalando session saved cookies so I can access my cart and checkout.
  cookies = pickle.load(open(f&quot;{COOKIES_PATH}&quot;, &quot;rb&quot;))
  for cookie in cookies:
      cookie_obj = requests.cookies.create_cookie(
          domain=cookie[&quot;domain&quot;], name=cookie[&quot;name&quot;], value=cookie[&quot;value&quot;])
      s.cookies.set_cookie(cookie_obj)
  
  res = s.get(&quot;https://www.zalando.es/checkout/confirm&quot;)
  
  soup = BeautifulSoup(res.text, &quot;lxml&quot;)
  
  data = soup.find_all(&quot;div&quot;)
  
  for attrs in data:
      section = attrs.get(&quot;data-props&quot;)
      if section:
          final = str(section).split(&quot;,&quot;)
          for info in final:
              if &quot;eTag&quot; in info:
                  eTag = str(info.split(&quot;:&quot;)[1])[3:-3]
              if &quot;checkoutId&quot; in info:
                  checkoutID = &quot;&quot;.join(str(info.split(&quot;:&quot;)[1].strip('&quot;')).split(&quot;&amp;quot;&quot;))
  
  s.headers[&quot;Accept&quot;] = &quot;*/*&quot;
  s.headers[&quot;Accept-Encoding&quot;] = &quot;gzip, deflate, br&quot;
  s.headers[&quot;Content-Type&quot;] = &quot;text/plain;charset=UTF-8&quot;
  s.headers[&quot;Referer&quot;] = &quot;https://www.zalando.es/checkout/confirm&quot;
  s.headers[&quot;Origin&quot;] = &quot;https://www.zalando.es&quot;
  
  cookies, cookie = [&quot;bm_sz&quot;, &quot;frsx&quot;, &quot;zac&quot;, &quot;zsr&quot;, &quot;zsi&quot;, &quot;zsa&quot;, &quot;mpulseinject&quot;,
                      &quot;Zalando-Client-Id&quot;, &quot;fvgs_ml&quot;, &quot;ak_bmsc&quot;, &quot;_abck&quot;, &quot;bm_sv&quot;], &quot;&quot;
  
  for name, value in s.cookies.get_dict().items():
      if name in cookies:
          cookie += f&quot;{name}={value}; &quot;
  
  s.headers[&quot;Cookie&quot;] = cookie[:-2]
  
  payload = {&quot;sensor_data&quot;: &quot;...&quot; }
  
  akamai = s.post(&quot;https://www.zalando.es/QP-swp7Px0/SRyH/rEGktd/9maOrLch/WlluOA/KS9r/OH59U0YB&quot;, json=payload)
  
  csrf = s.cookies.get_dict()[&quot;frsx&quot;]
  s.headers[&quot;X-Xsrf-Token&quot;] = csrf
  s.headers[&quot;Accept&quot;] = &quot;application/json&quot;
  s.headers[&quot;Content-Type&quot;] = &quot;application/json&quot;
  del s.headers[&quot;upgrade-insecure-requests&quot;]
  
  cookies, cookie = [&quot;bm_sz&quot;, &quot;frsx&quot;, &quot;zac&quot;, &quot;_gid&quot;, &quot;_ga&quot;, &quot;zsr&quot;, &quot;zsi&quot;, &quot;zsa&quot;, &quot;mpulseinject&quot;,
                      &quot;Zalando-Client-Id&quot;, &quot;fvgs_ml&quot; &quot;csrf-token&quot;, &quot;ak_bmsc&quot;, &quot;_abck&quot;, &quot;bm_sv&quot;], &quot;&quot;
  
  for name, value in s.cookies.get_dict().items():
      if name in cookies:
          cookie += f&quot;{name}={value}; &quot;
  
  s.headers[&quot;Cookie&quot;] = cookie[:-2]
  
  
  payload = {&quot;checkoutId&quot;: checkoutID,
              &quot;eTag&quot;: eTag }
  
  res = s.post(
      &quot;https://www.zalando.es/api/checkout/buy-now&quot;, json=payload)
  
  print(res.content)
  </code></pre>