Quantcast
Channel: Web services
Viewing all articles
Browse latest Browse all 2364

Using core_user_create_users In Python Script

$
0
0

by Sofiane beni.  

Hi,


I'm using Moodle 3.3.1 and in try to create an User withPython Script.

My Moodle web services configuration is good (i think).

But the user is not created, i have no error, nothing, just this line in my Apache logs :

[06/Sep/2017:16:24:32 +0200] "POST /webservice/rest/server.php?wstoken=XXXXXXXXXXX&wsfunction=core_user_create_users&moodlewsformat=json HTTP/1.1" 200 430 "-""python-requests/2.18.4


Here my Python Script :

#!/bin/python3.6

import requests

token = 'XXXXXXXXXXXXXXX'
function = 'core_user_create_users'

url = 'http://localhost/webservice/rest/server.php?wstoken={0}&wsfunction={1}&moodlewsformat=json'.format(token,function)

users = {'users[0][email]': 'test@mydept.edu',
        'users[0][firstname]': 'Test',
        'users[0][lastname]': 'Test1',
        'users[0][createpassword]': 1,
        'users[0][username]': 'Testst'}
requests.post(url,data=users)


Thank you in advance for your help.


Viewing all articles
Browse latest Browse all 2364

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>