<s> '''<STR_LIT>''' <EOL> """<STR_LIT>""" <EOL> import ssl <EOL> import requests <EOL> import json <EOL> import urllib <EOL> import os <EOL> __copyright__ = "<STR_LIT>" <EOL> __status__ = "<STR_LIT>" <EOL> class JiraAPI ( object ) : <EOL> def __init__ ( self , server , credentials ) : <EOL> super ( JiraAPI , self ) . __init__ ( ) <EOL> self . server = server <EOL> self . credentials = credentials <EOL> self . verify = None <EOL> __location__ = os . path . realpath ( os . path . join ( os . getcwd ( ) , os . path . dirname ( __file__ ) ) ) <EOL> if ( self . server == "<STR_LIT>" ) : <EOL> self . verify = os . path . join ( __location__ , '<STR_LIT>' ) <EOL> def fetchCommitDetails ( self , url ) : <EOL> r = requests . get ( url , auth = self . auth ( ) , verify = self . verify ) ; <EOL> if r . headers [ '<STR_LIT>' ] : <EOL> remaining_requests = int ( r . headers [ '<STR_LIT>' ] ) <EOL> if ( remaining_requests == <NUM_LIT:0> ) : <EOL> self . _no_more_requests_until = datetime . datetime . fromtimestamp ( float ( r . headers [ '<STR_LIT>' ] ) ) ; <EOL> return None <EOL> if ( r . ok ) : <EOL> return r . json ( ) <EOL> return None <EOL> def jql ( self , query , offset = None ) : <EOL> verbose = False <EOL> resource_name = "<STR_LIT>" <EOL> url = "<STR_LIT>" % ( self . server , urllib . quote ( resource_name ) ) <EOL> params = { "<STR_LIT>" : query } <EOL> if offset is not None : <EOL> params [ "<STR_LIT>" ] = offset <EOL> r = requests . get ( url , params = params , headers = { "<STR_LIT>" : self . credentials . authorizationHeaderValue ( ) } , verify = self . verify ) <EOL> if ( r . ok ) : <EOL> results = r . json ( ) <EOL> return results <EOL> else : <EOL> print "<STR_LIT>" , r . status_code <EOL> print r . text <EOL> return None <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> usercredentials_jsonfile = "<STR_LIT>" <EOL> user_creds_data = open ( usercredentials_jsonfile ) <EOL> user_creds = json . load ( user_creds_data ) <EOL> user = user_creds [ "<STR_LIT:user>" ] <EOL> password = user_creds [ "<STR_LIT>" ] <EOL> server_url = '<STR_LIT>' <EOL> jira = JiraAPI ( server_url , user , password ) <EOL> results = jira . jql ( '<STR_LIT>' ) </s>
