Hi,
For information I hacked something based on scrapy[1] to get the mail of all
users that belong to the Localizationlab group:
import scrapy
import sys
from scrapy.crawler import CrawlerProcess
class WeblateSpider(scrapy.Spider):
name = "weblate"
start_urls = ['https://weblate.securedrop.club/accounts/login/']
def parse(self, response):
return scrapy.FormRequest.from_response(
response,
formdata={'username': sys.argv[1], 'password': sys.argv[2]},
callback=self.after_login)
def after_login(self, response):
assert response.css('#profile-button')
return scrapy.Request(
url='https://weblate.securedrop.club/admin/auth/user/',
callback=self.user_list)
def user_list(self, response):
next_page =
response.xpath('//a[@title="Localizationlab"]/@href').extract_first()
return response.follow(next_page, self.localizationlab_list)
def localizationlab_list(self, response):
for mail in response.css('.field-email::text').extract():
print('A ' + str(mail))
process = CrawlerProcess({
'USER_AGENT': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)'
})
process.crawl(WeblateSpider)
process.start() # the script will block here until the crawling is finished
-
python script.py user passwordofuser
[1] https://scrapy.org/
On 03/16/2018 10:18 PM, Loïc Dachary wrote:
> Hi,
>
> Is it possible to query the users via the API? I would like to write a script
> to manage the list of users who have permission to **Approve** strings. It
> does not seem to be possible via the weblate API but maybe there is a way to
> access the Django API with a user that has access to /admin/ ?
>
> Thanks in advance
>
>
>
> ___
> Weblate mailing list
> Weblate@lists.cihar.com
> https://lists.cihar.com/cgi-bin/mailman/listinfo/weblate
>
--
Loïc Dachary, Artisan Logiciel Libre
signature.asc
Description: OpenPGP digital signature
___
Weblate mailing list
Weblate@lists.cihar.com
https://lists.cihar.com/cgi-bin/mailman/listinfo/weblate