From e9b709513749d85d966c7e34c430abd6cef90dc4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Michael=20O=2E=20Hegg=C3=B8?= <danmichaelo@gmail.com>
Date: Sat, 3 Aug 2019 01:24:40 +0200
Subject: [PATCH] Add workaround for phab:T211233

The post edit cookies makes no sense for bots, but it seems like the PR
for https://phabricator.wikimedia.org/T211233 is not going to be merged,
so we have to work around it.

Closes #221
---
 mwclient/page.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/mwclient/page.py b/mwclient/page.py
index b883011..6060fda 100644
--- a/mwclient/page.py
+++ b/mwclient/page.py
@@ -226,6 +226,11 @@ class Page(object):
         if 'newtimestamp' in result['edit'].keys():
             self.last_rev_time = parse_timestamp(result['edit'].get('newtimestamp'))
 
+        # Workaround for https://phabricator.wikimedia.org/T211233
+        for cookie in self.site.connection.cookies:
+            if 'PostEditRevision' in cookie.name:
+                self.site.connection.cookies.clear(cookie.domain, cookie.path, cookie.name)
+
         # clear the page text cache
         self._textcache = {}
         return result['edit']
-- 
GitLab