Repository: liberapay/liberapay.com

Issue:
GitLab support is broken
`{"error":"API V3 is no longer supported. Use API V4 instead."}`


Discussion:

Resolving patch:
diff --git a/liberapay/elsewhere/gitlab.py b/liberapay/elsewhere/gitlab.py
--- a/liberapay/elsewhere/gitlab.py
+++ b/liberapay/elsewhere/gitlab.py
@@ -26,7 +26,7 @@ class GitLab(PlatformOAuth2):
     # http://doc.gitlab.com/ce/api/
     api_format = 'json'
     api_paginator = header_links_paginator(total_header='X-Total')
-    api_url = 'https://gitlab.com/api/v3'
+    api_url = 'https://gitlab.com/api/v4'
     api_user_info_path = '/users/{user_id}'
     api_user_name_info_path = '/users?username={user_name}'
     api_user_self_info_path = '/user'


Test patch:
diff --git a/tests/py/fixtures/TestElsewhere.yml b/tests/py/fixtures/TestElsewhere.yml
--- a/tests/py/fixtures/TestElsewhere.yml
+++ b/tests/py/fixtures/TestElsewhere.yml
@@ -232,7 +232,7 @@ interactions:
     body: null
     headers: {}
     method: GET
-    uri: https://gitlab.com/api/v3/users?username=adhsjakdjsdkjsajdhksda
+    uri: https://gitlab.com/api/v4/users?username=adhsjakdjsdkjsajdhksda
   response:
     body: {string: !!python/unicode '[]'}
     headers:
@@ -240,8 +240,8 @@ interactions:
       content-length: ['2']
       content-type: [application/json]
       etag: [W/"d751713988987e9331980363e24189ce"]
-      link: ['<https://gitlab.com/api/v3/users?active=false&blocked=false&external=false&page=1&per_page=20&skip_ldap=false&username=adhsjakdjsdkjsajdhksda&with_custom_attributes=false>;
-          rel="first", <https://gitlab.com/api/v3/users?active=false&blocked=false&external=false&page=1&per_page=20&skip_ldap=false&username=adhsjakdjsdkjsajdhksda&with_custom_attributes=false>;
+      link: ['<https://gitlab.com/api/v4/users?active=false&blocked=false&external=false&page=1&per_page=20&skip_ldap=false&username=adhsjakdjsdkjsajdhksda&with_custom_attributes=false>;
+          rel="first", <https://gitlab.com/api/v4/users?active=false&blocked=false&external=false&page=1&per_page=20&skip_ldap=false&username=adhsjakdjsdkjsajdhksda&with_custom_attributes=false>;
           rel="last"']
       ratelimit-limit: ['600']
       ratelimit-observed: ['1']
@@ -255,7 +255,7 @@ interactions:
     body: null
     headers: {}
     method: GET
-    uri: https://gitlab.com/api/v3/users?username=%3E%27%3E%22%3E%3Cimg%20src%3Dx%20onerror%3Dalert%280%29%3E
+    uri: https://gitlab.com/api/v4/users?username=%3E%27%3E%22%3E%3Cimg%20src%3Dx%20onerror%3Dalert%280%29%3E
   response:
     body: {string: !!python/unicode '[]'}
     headers:
@@ -263,8 +263,8 @@ interactions:
       content-length: ['2']
       content-type: [application/json]
       etag: [W/"d751713988987e9331980363e24189ce"]
-      link: ['<https://gitlab.com/api/v3/users?active=false&blocked=false&external=false&page=1&per_page=20&skip_ldap=false&username=%3E%27%3E%22%3E%3Cimg+src%3Dx+onerror%3Dalert%280%29%3E&with_custom_attributes=false>;
-          rel="first", <https://gitlab.com/api/v3/users?active=false&blocked=false&external=false&page=1&per_page=20&skip_ldap=false&username=%3E%27%3E%22%3E%3Cimg+src%3Dx+onerror%3Dalert%280%29%3E&with_custom_attributes=false>;
+      link: ['<https://gitlab.com/api/v4/users?active=false&blocked=false&external=false&page=1&per_page=20&skip_ldap=false&username=%3E%27%3E%22%3E%3Cimg+src%3Dx+onerror%3Dalert%280%29%3E&with_custom_attributes=false>;
+          rel="first", <https://gitlab.com/api/v4/users?active=false&blocked=false&external=false&page=1&per_page=20&skip_ldap=false&username=%3E%27%3E%22%3E%3Cimg+src%3Dx+onerror%3Dalert%280%29%3E&with_custom_attributes=false>;
           rel="last"']
       ratelimit-limit: ['600']
       ratelimit-observed: ['2']