Giter Club home page Giter Club logo

ddmc.monitor's Introduction

ddmc.monitor

叮咚买菜运力监控,站点库存监控。监控叮咚站点首页信息购物车预约时间信息及站点库存存在日间随机更新的情况,通过Bark app通知到手机。

使用说明

抓包

首先需要自己使用Fiddler等工具对叮咚买菜小程序抓包(PC小程序比较方便),获取config.py中需要的参数。

运行

本脚本提供了三种监控方式,修改 run_type 切换:

  1. 站点首页关键字监控(免登陆,不会封号但可能封ip,默认使用)
    • 抓包获取站点id,填写station_id即可
    • 关键词不存在时则提醒(关键词为由于近期疫情问题,配送运力紧张,本站点当前运力已约满)
    • 可能相比购物车有延迟
  2. 购物车预约时间监控(需要登录,有封号风险,谨慎使用)
    • 需要填写UA等信息作为header
    • 然后raw_body填Fiddler里面请求信息的Raw tab最下面的一串url格式的字符串(类似uid=xxx&longitude=xxx,购物车点结算-预约时间就有了)
  3. 自己站点菜品库存和更新提醒
    • 需要填写 station_id,longitude, latitude
    • 可以自己从 name_of_all_categories 中挑选并添加或修改自己关心的分类的菜品到 name_of_categories_i_care 中。

执行main.py即可

依赖

  • python3
  • requests

声明

仅供学习交流使用,请勿用于非法用途。

ddmc.monitor's People

Contributors

finch-ift avatar jozhn avatar sqvktfet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ddmc.monitor's Issues

库存监控check_stock方法中json文件转换报错,麻烦大大瞅瞅

代码报错在这里json load的时候

with open("all_categories_formatted.json") as f:
flag = False
all_categories = json.load(f)
错误信息如下
UnicodeDecodeError: 'gbk' codec can't decode byte 0x9c in position 38: illegal multibyte sequence
感觉是商品列表的json有问题,但是我查了一下json格式是没有问题的。
PS:购物车监控运力运行良好 谢谢大大啦。

执行main.py后check_stock报错

执行main.py后check_stock报错:
Traceback (most recent call last):

File "D:\1\main.py", line 94, in

run()

File "D:\1\main.py", line 84, in run

check_stock()

File "D:\1\check_stock.py", line 117, in check_stock

if len(menu['products']) > 0:

TypeError: 'NoneType' object is not subscriptable

check_cart返回参数错误

{'success': False, 'code': 1, 'msg': '参数错误', 'data': [], 'tradeTag': 'success', 'server_time': 1649842991, 'is_trade': 1}
请求异常!

执行python3 main.py后出现错误

我不懂python,只是为了抢菜。我是用iphone连mac charles

先根据charles抓包内容,配置了config.py。

pip3 install requests后,出现下面这些,我也不知道算安装成功了没有:

DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
Requirement already satisfied: requests in /usr/local/lib/python3.9/site-packages (2.25.1)
Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.9/site-packages (from requests) (2.10)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.9/site-packages (from requests) (2020.12.5)
Requirement already satisfied: chardet<5,>=3.0.2 in /usr/local/lib/python3.9/site-packages (from requests) (4.0.0)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.9/site-packages (from requests) (1.26.4)
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621

运行python3 main.py,等了好几秒后,出现这个错误:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 445, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 440, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1377, in getresponse
    response.begin()
  File "/usr/local/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 320, in begin
    version, status, reason = self._read_status()
  File "/usr/local/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 289, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "/usr/local/lib/python3.9/site-packages/urllib3/util/retry.py", line 532, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/local/lib/python3.9/site-packages/urllib3/packages/six.py", line 734, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 445, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 440, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1377, in getresponse
    response.begin()
  File "/usr/local/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 320, in begin
    version, status, reason = self._read_status()
  File "/usr/local/Cellar/[email protected]/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 289, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/ddbbdd/ddmc.monitor/main.py", line 94, in <module>
    run()
  File "/Users/ddbbdd/ddmc.monitor/main.py", line 82, in run
    check_cart()
  File "/Users/ddbbdd/ddmc.monitor/main.py", line 56, in check_cart
    r = requests.post(url, headers=headers, data=raw)
  File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 119, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

不知道哪里配置不对?谢谢

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.