Drinkhuahuaniu / INShuaKe

干部网络学院刷课
19 stars 3 forks source link

代码提示网络异常 #7

Closed zzgg121 closed 3 months ago

zzgg121 commented 3 months ago

屏幕截图 2024-07-10 213445 当我试图运行时发现提示”网络异常!请再次运行!”,当我尝试再次运行时仍提示此问题,所以我试图查找问题, 2 我发现到这一步会出错,原因可能是没有找到课程信息? response内容是: apparent_encoding = {str} 'ascii' connection = {HTTPAdapter} <requests.adapters.HTTPAdapter object at 0x0000029B7E92A720> content = {bytes: 56} b'{"Type":0,"Message":" :)","Data":null,"IsSuccess":false}' cookies = {RequestsCookieJar: 3} <RequestsCookieJar[Cookie(version=0, name='acw_tc', value='2760820117206186182536791e2d299a17e937523d80e96660c7a73895b589', po...path_specified=True, secure=False, expires=1720733630, discard=False, comment=None, comment_url=None, rest={}, rfc2109=False)]> elapsed = {timedelta} datetime.timedelta(microseconds=633744) encoding = {str} 'utf-8' headers = {CaseInsensitiveDict: 14} {'Date': 'Wed, 10 Jul 2024 13:36:58 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Content-Length': '56', 'Connecti...ue', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block', 'Strict-Transport-Security': 'max-age=31536000'} history = {list: 1} [<Response [302]>] is_permanent_redirect = {bool} False is_redirect = {bool} False links = {dict: 0} {} next = {NoneType} None ok = {bool} True raw = {HTTPResponse} <urllib3.response.HTTPResponse object at 0x0000029B27796410> reason = {str} 'OK' request = {PreparedRequest} <PreparedRequest [GET]> status_code = {int} 200 text = {str} '{"Type":0,"Message":" :)","Data":null,"IsSuccess":false}' url = {str} 'https://www.hngbwlxy.gov.cn/api/common/Error600?message=' 以上内容

zzgg121 commented 3 months ago

response.json()内容是这些

3

zzgg121 commented 3 months ago

我已经解决了,经过排查 我发现应该是负载有所改变,data['channelId'] = channel_id 和data['rows'] = rowlength不需要运行,data = { 'page': '1', 'rows': '9', 'sort': 'Sort', 'order': 'desc', 'courseType': 'All', 'channelId': '', 'title': '', 'titleNav': '课程中心', 'wordLimt': '35', 'teacher': '', 'flag': 'all', 'isSearch': '0', 'channelCode': '', 'isImportant': '' }data内容进行修改就可以了