Send patch as JSON which is needed for state to work

This commit is contained in:
benjamin melançon 2023-10-04 21:31:13 -04:00
parent 9ec60e1c4d
commit 08a78d0bf2

View file

@ -96,12 +96,11 @@ def move_issue(source_owner, source_repo, issue_number, destination_owner, desti
# Note though we often change the owner and repo and index when making the URL! # Note though we often change the owner and repo and index when making the URL!
# This runs and the state string is correct and it *should* work but it does not. # This runs and the state string is correct and it *should* work but it does not.
# See https://codeberg.org/forgejo/forgejo/issues/1280#issuecomment-1262414 # See https://codeberg.org/forgejo/forgejo/issues/1280#issuecomment-1262414
patch = { body = {
# 'title': "MOVED", "state": "closed"
'state': "closed"
} }
patch_issue_url = API_PATCH_ISSUE.format(instance=FORGEJO_INSTANCE, owner=source_owner, repo=source_repo, index=issue_number) patch_issue_url = API_PATCH_ISSUE.format(instance=FORGEJO_INSTANCE, owner=source_owner, repo=source_repo, index=issue_number)
closed_response = requests.patch(patch_issue_url, headers=headers, data=patch) closed_response = requests.patch(patch_issue_url, headers=headers, json=body, params={"access_token": FORGEJO_API_TOKEN})
# print(closed_response.json()) # print(closed_response.json())
if __name__=="__main__": if __name__=="__main__":