Requests.put results in 405 error

I’m trying to update a page on confluence.
Reading its content works fine, but updating gives 405 error “The specified HTTP method is not allowed for the requested resource”
Here is my code:

import requests
import json
auth=('<name>', 'pwd')
url_base = ''

url = url_base + '/conf/rest/api/content'
data1= \
{ 'body': {
          'view': {
                   'value': '<p><b>A sample</b> Wiki page</p><p>Line2 going to '
                            'version 4</p><p>End</p>'}},
 'version': {
             'number': 3,
             'when': '2017-10-06T15:16:17.501-04:00'}}
headers = {'Content-Type': 'application/json'}
requests.put(url, data = json.dumps(data1), auth=auth, headers=headers)

Please help

Hi @vsluzky23 - you need to include the page ID at the end of the URL when updating. ex: /conf/rest/api/content/12345.