Hello
I have generated authentication token and able to make REST calls from my browser and get response.
Now I am trying to make the same thing work from my python program and I get status code 403
Why is it forbidden?
when I tried both user/pass and token combinations as shown below.
Please let me know.
import requests
print "hello world"
# r = requests.get("http://myfisheye:2003",auth=("myuser","mypass"))
# r = requests.get("http://myfisheye:2003/rest-service-fecru/admin/groups?FEAUTH=myuser:1:xxxx50713b31b7859c9c0cd6f19e4568b372e992")
r = requests.get("http://myfisheye:2003/rest-service-fecru/admin/repositories?FEAUTH=modha.k:1:xxxx50713b31b7859c9c0cd6f19e4568b372e992")
print r.status_code
Thanks
Abe
Solved:
For anyone who is looking for a solution
/rest-service-fecru/auth/login
in conn.request.
use
I have tried this varient
import httplib
import urllib
conn = httplib.HTTPConnection("myfisheye:2003")
args = urllib.urlencode({'userName':'myuser', 'password':'mypassword'})
#args = urllib.urlencode({'FEAUTH':'myuser:1:xxxx50713b31b7859c9c0cd6f19e4568b372e992'})
headers = {'Accept':'application/json'}
r1 = conn.request("post","/rest-service/auth/login",args,headers)
#conn.request("get","/rest-service-fecru/admin/groups",args,headers)
r2 = conn.getresponse()
print r1,r2.status,r2.reason,r2
Got this as response:
====================
/home/myuser/env3/bin/python /home/modha.k/PycharmProjects/mysample/test.py
None 404 Crucible is not enabled <httplib.HTTPResponse instance at 0xc29248>
hello world
Process finished with exit code 0
I have also added IPAddress of fisheye in Jira user server.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.