## How to authenticate to Wikimedia Commons Query Service using OAuth in Python?

(discussiontools-topicheader-latestcomment: 1613241060)(discussiontools-topicheader-commentcount: 3)(discussiontools-topicheader-authorcount: 3)
(discussiontools-topicsubscription-button-subscribe-label)

This page says it's possible to authenticate against the query service using OAuth, but has anyone managed to do so programmatically from Python? If anyone has any working code, in any language, I would appreciate whatever you can share. I've asked the full question including my not-working Python code on StackOverflow: https://stackoverflow.com/questions/65303450/how-to-authenticate-to-wikimedia-commons-query-service-using-oauth-in-python --FrankieRayRobertson (talk) 13:38, 21 December 2020 (UTC)(discussiontools-replybutton)

  @Multichill: do you have example code for this / are you using WCQS with python? --Zache (talk) 06:55, 4 January 2021 (UTC)(discussiontools-replybutton)
    @Zache: no, would have to look into this. Should be part of Pywikibot if someone figures it out. Did you already file a task in phabricator to add support for https://wcqs-beta.wmflabs.org/ ? Multichill (talk) 18:31, 13 February 2021 (UTC)(discussiontools-replybutton)

## HTTP 500, server down?

(discussiontools-topicheader-latestcomment: 1640953140)(discussiontools-topicheader-commentcount: 3)(discussiontools-topicheader-authorcount: 2)
(discussiontools-topicsubscription-button-subscribe-label)

For me `https://wcqs-beta.wmflabs.org/` throws a 500 Internal Server Error:

    Problem accessing /oauth/check_login. Reason:
    Request failed.

Is this known? Any information when the query service might be back? Thanks in advance for any information or linking to relevant other places! --Marsupium (talk) 00:30, 28 December 2021 (UTC)(discussiontools-replybutton)

  @Marsupium: issue was reported in T297454--Shisma (talk) 11:48, 31 December 2021 (UTC)(discussiontools-replybutton)
  Tracked in Phabricator
  Task T297454
    Thanks for the link! --Marsupium (talk) 12:19, 31 December 2021 (UTC)(discussiontools-replybutton)

    newestComment: {
    	"id": "c-Marsupium-2021-12-31T12:19:00.000Z-Shisma-2021-12-31T11:48:00.000Z",
    	"timestamp": "2021-12-31T12:19:00.000Z",
    	"author": "Marsupium",
    	"heading": {
    		"headingLevel": 2,
    		"name": "h-Marsupium-2021-12-28T00:30:00.000Z",
    		"type": "heading",
    		"level": 0,
    		"id": "h-HTTP_500,_server_down?-2021-12-28T00:30:00.000Z",
    		"replies": [
    			"c-Marsupium-2021-12-28T00:30:00.000Z-HTTP_500,_server_down?"
    		],
    		"text": "HTTP 500, server down?",
    		"linkableTitle": "HTTP 500, server down?"
    	}
    }
    {
    	"wgDiscussionToolsPageThreads": [
    		{
    			"headingLevel": 2,
    			"name": "h-FrankieRayRobertson-2020-12-21T13:38:00.000Z",
    			"type": "heading",
    			"level": 0,
    			"id": "h-How_to_authenticate_to_Wikimedia_Commons_Query_Service_using_OAuth_in_Python?-2020-12-21T13:38:00.000Z",
    			"replies": [
    				{
    					"timestamp": "2020-12-21T13:38:00.000Z",
    					"author": "FrankieRayRobertson",
    					"type": "comment",
    					"level": 1,
    					"id": "c-FrankieRayRobertson-2020-12-21T13:38:00.000Z-How_to_authenticate_to_Wikimedia_Commons_Query_Service_using_OAuth_in_Python?",
    					"replies": [
    						{
    							"timestamp": "2021-01-04T06:55:00.000Z",
    							"author": "Zache",
    							"type": "comment",
    							"level": 2,
    							"id": "c-Zache-2021-01-04T06:55:00.000Z-FrankieRayRobertson-2020-12-21T13:38:00.000Z",
    							"replies": [
    								{
    									"timestamp": "2021-02-13T18:31:00.000Z",
    									"author": "Multichill",
    									"type": "comment",
    									"level": 3,
    									"id": "c-Multichill-2021-02-13T18:31:00.000Z-Zache-2021-01-04T06:55:00.000Z",
    									"replies": []
    								}
    							]
    						}
    					]
    				}
    			]
    		},
    		{
    			"headingLevel": 2,
    			"name": "h-Marsupium-2021-12-28T00:30:00.000Z",
    			"type": "heading",
    			"level": 0,
    			"id": "h-HTTP_500,_server_down?-2021-12-28T00:30:00.000Z",
    			"replies": [
    				{
    					"timestamp": "2021-12-28T00:30:00.000Z",
    					"author": "Marsupium",
    					"type": "comment",
    					"level": 1,
    					"id": "c-Marsupium-2021-12-28T00:30:00.000Z-HTTP_500,_server_down?",
    					"replies": [
    						{
    							"timestamp": "2021-12-31T11:48:00.000Z",
    							"author": "Shisma",
    							"type": "comment",
    							"level": 2,
    							"id": "c-Shisma-2021-12-31T11:48:00.000Z-Marsupium-2021-12-28T00:30:00.000Z",
    							"replies": [
    								{
    									"timestamp": "2021-12-31T12:19:00.000Z",
    									"author": "Marsupium",
    									"type": "comment",
    									"level": 3,
    									"id": "c-Marsupium-2021-12-31T12:19:00.000Z-Shisma-2021-12-31T11:48:00.000Z",
    									"replies": []
    								}
    							]
    						}
    					]
    				}
    			]
    		}
    	]
    }