Python请求pos方法422无法处理的实体错误

时间:2020-05-02 14:31:28

标签: python github request http-status-code-422 github-issues

大家。我想在Github上使用python发送新问题,但是我不想使用github api。而且我正在接受422错误。也许我的方法有问题。我不知道 。你能帮助我吗。我是Python的新手。

import requests
from bs4 import BeautifulSoup

with requests.Session() as s:
      url = "https://github.com/session"
      r = s.get(url, headers=headers)
      soup = BeautifulSoup(r.content, "lxml")
      login_data['authenticity_token'] = soup.find("input", attrs={"name": "authenticity_token"})['value']
      r = s.post(url, data=login_data, headers=headers)

      url2 = "https://github.com/sadikizgi/dribbbleClonOnRails/issues"
      r2 = s.get(url2)
      soup2 = BeautifulSoup(r2.content, "lxml")
      issue_data['authenticity_token'] = soup2.find("input", attrs={"name": "authenticity_token"})['value']
      issue_data['timestamp'] = soup2.find("input", attrs={"name": "timestamp"})['value']
      issue_data['timestamp_secret'] = soup2.find("input", attrs={"name": "timestamp_secret"})['value']
      r2 = s.post(url2, data=issue_data, headers=headers)
      print(issue_data)
      print(r2.status_code)

0 个答案:

没有答案