#8394 Pushing wiki page using API fails

self-service
nobody
api (5) wiki (20)
ddclient
2015-02-08
2014-08-20
wimpunk
No

Hi,

I'm trying to push a page with this simple python script:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/python

import requests
from pprint import pprint
# create a file named myapi.py
# add your api from sf.net to the file:
# BEARER_TOKEN = 'my-api-from-sf.net'
import myapi

f = open('moving-trac.md','r')
text = f.read()
f.close()

r = requests.post('https://sourceforge.net/rest/p/ddclient/wiki/movingtrac',
            params={
                'text': text,
                'labels': '',
                'access_token': myapi.BEARER_TOKEN
            })
if r.status_code == 200:
    print 'Wiki created at: %s' % r.url
else:
    print 'Error [%s]:\n%s' % (r.status_code, r.text)

but I keep getting 403 Forbidden although I'm the project administrator and I'm allowed to create new pages. What am I interpreting wrong from your API?

Kind regards,

wim vinckier.

Discussion

  • Greetings,

    Check that the api token is correct on https://sourceforge.net/auth/oauth/

    Regards,

    Roberto Galoppini, SourceForge.net

     
    • status: unread --> self-service
     
  • wimpunk
    wimpunk
    2014-08-25

    So I can't do it with the one registered on https://sourceforge.net/account/ ? According to the api, that one should also work. At least that API-key works to get the wiki from sf.net. Without it, my download script doesn't work.

    wimpunk.