need some expert to help me debug a Python scraping code

I have a Python server to scrap tracking numbers to a website: www.ems.com.cn

It will bypass the captcha in that website, then submit tracking number to target server https://www.ems.com.cn

Then it will get the following result :

Above result is actually a json text string. Python code will send the json code back to user who submitted the tracking number.

In actually program, we will run following command to start this python server:
docker-compose up -d

 

Then client can submit the tracking number by HTTP request, for example we can use curl command to get json response:

curl “http://server_IP:5000/ems/track?tracking_number=LV753481665CN&proxy=1&lang=cn”

It should return a json text which has correct result in Chinese, but now it returns following:

{“success”:false,”msg”:”Internal Error!”,”error”:”Expecting value: line 1 column 1 (char 0)”}

You must be familiar with following libraries:
import hashlib
import base64
import json, random, traceback
import requests
from requests.exceptions import ProxyError
from PIL import Image
from io import BytesIO
import cv2
import numpy as np

Please do NOT use headless scraping libraries such as Selenium or similar, headless library has too much memory cost and will crash my server. Also do NOT use paid captcha bypass service, we have too many requests, paid service is too expensive for us.

 

For testing purpose, please use following tracking number to test www.ems.com.cn


LV957478336CN

LP717780070CN

LV967714391CN

original code is here:
https://osoyoo.info/upload/PostAPI.tar.gz

Leave a Reply

Your email address will not be published. Required fields are marked *