Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Fisheye rest status code 403

AbrahamA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 8, 2017

 

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

2 answers

1 accepted

0 votes
Answer accepted
AbrahamA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 8, 2017

Solved:

For anyone who is looking for a solution

 

/rest-service-fecru/auth/login
in conn.request.

 use 

0 votes
AbrahamA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 8, 2017

 

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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events