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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Jira for us is hosted at https://jirasw.t-mobile.com/. How do i access it via python

Jira for us is hosted at https://jirasw.t-mobile.com/. How do i access it via python

 

All examples in Web are about connecting to atlassian using token.

But how do i connect to https://jirasw.t-mobile.com/ which is the implementation that i have in my company

1 answer

0 votes

@John Kingson

If you are using REST API,  typically you should just be able to access by encoding your username and password in base 64.

 

In the document here, they show how you access using that Atlassian API token. It's the same process for server, but instead of generating the API token and encoding email:token, you just encode username:password.

 

Thanks,

Kian

Hello Kian,

I already have a login on https://jirasw.t-mobile.com/

But when I open https://id.atlassian.com/manage/api-tokens and type in my existing email_id present in with Jira, it is not recognizing it.

It is asking my to create a new profile using the email_id I have typed in.

So basically, looks like https://jirasw.t-mobile.com/ and Atlassian are not on the same platform? Is this is the reason why I am getting the option to "create a new profile" instead of allowing to login using my existing email_id / password?

So the question still remains, how do I access https://jirasw.t-mobile.com/ via python.

@John Kingson

 

No, https://jirasw.t-mobile.com/ is not an Atlassian hosted website. You don't need to generate an API token, just use your username and password that you use to sign into the system. That should be sufficient!

Thanks,

 

Kian

Hello Kian,

Get below error when I do it that way:

Basic Authentication Failure - Reason : AUTHENTICATION_DENIED

 

 

Have used the following code:

import requests
import json
import base64

# Base encode email and api token
cred =  "Basic " + base64.b64encode(b'jkingso1@gsm1900.org:<password>').decode("utf-8")
# Set header parameters
headers = {
   "Accept": "application/json",
   "Content-Type": "application/json",
   "Authorization" : cred
}

# Enter your project key here
projectKey = "Digital Billing - Samson (Magenta)"

# Update your site url
url = "https://jirasw.t-mobile.com/secure/Dashboard.jspa" + projectKey

# Send request and get response
response = requests.request(
   "GET",
   url,
   headers=headers
)

print (response.text)

# Decode Json string to Python
json_data = json.loads(response.text)

# Display issues
for item in json_data["issues"]:
    print(item["id"] + "\t" + item["key"] + "\t" +
        item["fields"]["issuetype"]["name"] + "\t" +
        item["fields"]["created"]+ "\t" +
        item["fields"]["creator"]["displayName"] + "\t" +
        item["fields"]["status"]["name"] + "\t" +
        item["fields"]["summary"] + "\t"
        )

 

 

 

 

 

But getting following error:

<html>

<head>
    <title>Forbidden (403)</title>
   

 


<!--[if IE]><![endif]-->
<script type="text/javascript">
    (function() {
        var contextPath = '';
        var eventBuffer = [];

        function printDeprecatedMsg() {
            if (console && console.warn) {
                console.warn('DEPRECATED JS - contextPath global variable has been deprecated since 7.4.0. Use `wrm/context-path` module instead.');
            }
        }

        function sendEvent(analytics, postfix) {
            analytics.send({
                name: 'js.globals.contextPath.' + postfix
            });
        }

        function sendDeprecatedEvent(postfix) {
            try {
                var analytics = require('jira/analytics');
                if (eventBuffer.length) {
                    eventBuffer.forEach(function(value) {
                        sendEvent(analytics, value);
                    });
                    eventBuffer = [];
                }

                if (postfix) {
                    sendEvent(analytics, postfix);
                }
            } catch(ex) {
                eventBuffer.push(postfix);
                setTimeout(sendDeprecatedEvent, 1000);
            }
        }

        Object.defineProperty(window, 'contextPath', {
            get: function() {
                printDeprecatedMsg();
                sendDeprecatedEvent('get');
                return contextPath;
            },
            set: function(value) {
                printDeprecatedMsg();
                sendDeprecatedEvent('set');
                contextPath = value;
            }
        });
    })();

</script>
<script>

 

<script type="text/javascript" src="/rest/api/1.0/shortcuts/805001/d3fc5f2eb9f6818413c6198f51ae59f6/shortcuts.js"></script>


    <meta name="application-name" content="JIRA" data-name="jira" data-version="8.5.1">
</head>
<body id="jira" class="aui-layout aui-style-default page-type-message"  data-version="8.5.1" >
    <div class="aui-page-panel"><div class="aui-page-panel-inner">
            <section class="aui-page-panel-content">
                    <header class="aui-page-header"><div class="aui-page-header-inner">
                            <div class="aui-page-header-main">
                                    <h1>Forbidden (403)</h1>
                                </div><!-- .aui-page-header-main -->
                        </div><!-- .aui-page-header-inner --></header><!-- .aui-page-header -->
                    <div class="aui-message aui-message-warning warning">
                            <p>Encountered a <code>&quot;403 - Forbidden&quot;</code> error while loading this page.</p>
                            <p>Basic Authentication Failure - Reason : AUTHENTICATION_DENIED</p>
                            <p><a href="/secure/MyJiraHome.jspa">Go to Jira home</a></p>
                        </div>
                </section><!-- .aui-page-panel-content -->
        </div><!-- .aui-page-panel-inner --></div><!-- .aui-page-panel -->
</body>
</html>

Can you please ensure that your account doesn't have Captcha on it  at the moment?

Yes it does have Captcha.

Alternate way was to login via okta and then use the Jira Link.

So another logic will be need in this case?

Hmm, 

Do you know how the authentication mechanism is set up? You said that you are able to sign in through Okta, do you have Jira Data Center? Do you know your company is using a plugin to connect to Okta?

Thanks,

Kian

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you