diff --git a/README.rst b/README.rst index 4c1b8ad..6d08c54 100644 --- a/README.rst +++ b/README.rst @@ -210,9 +210,9 @@ an API client, and should be performed separately by your application. For further information on OAuth 2 authentication with PagerDuty, refer to the official documentation: -* `OAuth 2 Functionality ` -* `OAuth 2: PKCE Flow ` -* `OAuth 2: Authorization Code Grant Flow ` +* `OAuth 2 Functionality `_ +* `OAuth 2: PKCE Flow `_ +* `OAuth 2: Authorization Code Grant Flow `_ General Concepts **************** diff --git a/docs/_static/documentation_options.js b/docs/_static/documentation_options.js index 2b3a80e..a62932e 100644 --- a/docs/_static/documentation_options.js +++ b/docs/_static/documentation_options.js @@ -1,6 +1,6 @@ var DOCUMENTATION_OPTIONS = { URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), - VERSION: '3.2.1', + VERSION: '4.0', LANGUAGE: 'None', COLLAPSE_INDEX: false, BUILDER: 'html', diff --git a/docs/genindex.html b/docs/genindex.html index cbd2253..fa0ae1e 100644 --- a/docs/genindex.html +++ b/docs/genindex.html @@ -5,7 +5,7 @@ - Index — PagerDuty Python REST API Sessions 3.2.1 documentation + Index — PagerDuty Python REST API Sessions 4.0 documentation @@ -55,15 +55,33 @@

A

  • api_time (pdpyras.APISession attribute)
  • APISession (class in pdpyras) +
  • +
  • auth_header() (pdpyras.APISession property) + +
  • +
  • auth_type() (pdpyras.APISession property)
  • auto_json() (in module pdpyras)
  • @@ -213,18 +231,12 @@

    S

      -
    • sleep_timer (pdpyras.PDSession attribute) -
    • sleep_timer_base (pdpyras.PDSession attribute)
    • stagger_cooldown() (pdpyras.PDSession property) @@ -260,10 +272,6 @@

      U

      -
      diff --git a/docs/index.html b/docs/index.html index e797fbe..5faae49 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4,7 +4,7 @@ - PDPYRAS: PagerDuty Python REST API Sessions — PagerDuty Python REST API Sessions 3.2.1 documentation + PDPYRAS: PagerDuty Python REST API Sessions — PagerDuty Python REST API Sessions 4.0 documentation @@ -41,7 +41,7 @@

      PDPYRAS: PagerDuty Python REST API Sessions

      About

      This library supplies a class pdpyras.APISession extending -requests.Session from the Requests HTTP library. It serves as a practical +requests.Session from the Requests HTTP library. It serves as a practical and simple-as-possible-but-no-simpler HTTP client for accessing the PagerDuty REST API and events API.

      It takes care of all of the most common prerequisites and necessities @@ -75,7 +75,7 @@

      Historypagination and header-setting commonly associated with REST API usage. Finally, we discovered -that the way we were using requests wasn’t making use of connection re-use, +that the way we were using requests wasn’t making use of connection re-use, and wanted a way to easily enforce this as a standard practice.

      Ultimately, we deemed most other libraries to be both overkill for this task and also not very conducive to use for experimental API calls.

      @@ -121,7 +121,7 @@

      Installation
      pip install pdpyras
       
      -

      Alternately, if requests has already been installed locally, and urllib3 +

      Alternately, if requests has already been installed locally, and urllib3 is available, one can simply download pdpyras.py into the directory where it will be used.

      @@ -204,6 +204,27 @@

      Basic Usage +

      Using an OAuth 2 Access Token to Authenticate

      +

      When using an OAuth2 token, include the keyword argument auth_type='oauth2' +or auth_type='bearer' to the constructor. This tells the client to set the +Authorization header appropriately in order to use this type of API +credential.

      +

      Example:

      +
      from pdpyras import APISession
      +session = APISession(oauth_token_here, auth_type='oauth2')
      +
      +
      +

      Note, obtaining an access token via the OAuth 2 flow is outside the purview of +an API client, and should be performed separately by your application.

      +

      For further information on OAuth 2 authentication with PagerDuty, refer to the +official documentation:

      + +

      General Concepts

      In all cases, when sending or receiving data through the REST API using @@ -244,7 +265,7 @@

      Request and Response Bodiesdict object (or list, where applicable) in the json keyword argument.

    • To get the response body as a dict (or list, if applicable), call -the json +the json method of the response object.

    • If using the r{VERB} methods, i.e. rget, the return value will be the dict/list object decoded from the wrapped entity and there is @@ -259,7 +280,7 @@

      Request and Response Bodies

      Using Special Features of Requests

      Keyword arguments to the HTTP methods get passed through to the similarly- -named functions in requests.Session, so for additional options, please refer +named functions in requests.Session, so for additional options, please refer to the documentation provided by the Requests project.

      @@ -465,7 +486,7 @@

      Error Handlingrequests.Response object as its response property (whenever the +the requests.Response object as its response property (whenever the exception pertains to a HTTP error), the end user can define specialized error handling logic in which the REST API response data (i.e. headers, code and body) are directly available.

      @@ -505,7 +526,7 @@

      Error Handling

      HTTP Retry Logic

      By default, after receiving a response, pdpyras.PDSession.request will -return the requests.Response object unless its status is 429 (rate +return the requests.Response object unless its status is 429 (rate limiting), in which case it will retry until it gets a status other than 429.

      The property pdpyras.PDSession.retry allows customization in this regard, so that the client can be made to retry on other statuses (i.e. @@ -517,7 +538,7 @@

      HTTP Retry Logicrequests.Response object:

      +before finally returning with the status 404 requests.Response object:

      session.retry[404] = 5
       session.max_http_attempts = 4
       session.sleep_timer = 1
      @@ -596,7 +617,7 @@ 

      Generic API Client class pdpyras.PDSession(api_key, name=None)

      Base class for making HTTP requests to PagerDuty APIs.

      -

      Instances of this class are essentially the same as requests.Session +

      Instances of this class are essentially the same as requests.Session objects, but with a few modifications:

      +
      +
      +after_set_api_key()
      +

      Setter hook for setting or updating the API key.

      +

      Child classes should implement this to perform additional steps.

      +
      +
      property api_key
      @@ -616,6 +644,23 @@

      Generic API Client +
      +property api_key_access
      +

      Memoized API key access type getter.

      +

      Will be “user” if the API key is a user-level token (all users should +have permission to create an API key with the same permissions as they +have in the PagerDuty web UI).

      +

      If the API key in use is an account-level API token (as only a global +administrator user can create), this property will be “account”.

      +

      + +
      +
      +property auth_header
      +

      Generates the header with the API credential used for authentication.

      +
      +
      log = None
      @@ -640,7 +685,7 @@

      Generic API Client
      parent = None
      -

      The super object (requests.Session)

      +

      The super object (requests.Session)

      @@ -686,7 +731,7 @@

      Generic API Clientrequests.Session.request

      +
    • **kwargs

      Additional keyword arguments to pass to requests.Session.request

    @@ -694,7 +739,7 @@

    Generic API Client

    the HTTP response object

    Return type
    -

    requests.Response

    +

    requests.Response

    @@ -707,7 +752,7 @@

    Generic API Client
  • -1 to retry infinitely

  • -
  • 0 to return the requests.Response object and exit (which is the +

  • 0 to return the requests.Response object and exit (which is the default behavior)

  • n, where n > 0, to retry n times (or up to max_http_attempts total for all statuses, whichever is @@ -723,11 +768,12 @@

    Generic API Client
    set_api_key(api_key)
    -

    Set the API key/token.

    -

    Child classes should implement this method to do special things like -setting default headers.

    -

    The getter will return the value of self._api_key, so any setters should -set this property.

    +

    (Deprecated) set the API key/token.

    +
    +
    Parameters
    +

    api_key (str) – The API key to use

    +
    +
    @@ -779,12 +825,6 @@

    Generic API Client -
    -property user_agent
    -

    Unique user-agent header for making requests

    -

    - @@ -794,7 +834,7 @@

    REST API Client
    -class pdpyras.APISession(api_key, name=None, default_from=None)
    +class pdpyras.APISession(api_key, name=None, default_from=None, auth_type='token')

    Reusable PagerDuty REST API session objects for making API requests.

    Includes some convenience functions as well, i.e. rget, find and iter_all, to eliminate some repetitive tasks associated with @@ -833,6 +873,13 @@

    REST API Clientrput(self, path, **kw)
    +
    +
    +after_set_api_key()
    +

    Setter hook for setting or updating the API key.

    +

    Child classes should implement this to perform additional steps.

    +
    +
    api_call_counts = None
    @@ -845,6 +892,19 @@

    REST API Client +
    +property auth_header
    +

    Generates the header with the API credential used for authentication.

    +

    + +
    +
    +property auth_type
    +

    Defines the method of API authentication.

    +

    By default this is “token”; if “oauth2”, the API key will be used.

    +
    +
    default_from = None
    @@ -978,7 +1038,7 @@

    REST API ClientParameters
    @@ -1017,16 +1077,6 @@

    REST API Client -
    -set_api_key(api_key)
    -

    Set the API key/token.

    -

    Child classes should implement this method to do special things like -setting default headers.

    -

    The getter will return the value of self._api_key, so any setters should -set this property.

    -

    -
    property subdomain
    @@ -1086,6 +1136,12 @@

    Events API Client +
    +property auth_header
    +

    Generates the header with the API credential used for authentication.

    +

    +
    prepare_headers(method)
    @@ -1125,17 +1181,6 @@

    Events API Client -
    -set_api_key(api_key)
    -

    Sets the routing key in the X-Routing-Key header.

    -
    -
    Parameters
    -

    api_key (str) – The routing key to use for this session.

    -
    -
    -

    -
    trigger(summary, source, dedup_key=None, severity='critical', payload=None, custom_details=None, images=None, links=None)
    @@ -1223,13 +1268,13 @@

    Errors

    Raise an exception if a HTTP error response has error status.

    Parameters
    -

    r (requests.Response) – Response object corresponding to the response received.

    +

    r (requests.Response) – Response object corresponding to the response received.

    Returns

    The response object, if its status was success

    Return type
    -

    requests.Response

    +

    requests.Response

    @@ -1246,9 +1291,9 @@

    Errors

    This makes the request methods GET, POST and PUT always return a dictionary object representing the resource at the envelope property (i.e. the {...} from {"escalation_policy":{...}} in a get/put request to -an escalation policy) rather than a requests.Response object.

    +an escalation policy) rather than a requests.Response object.

    Methods using this decorator will raise a PDClientError with its -response property being being the requests.Response object in the +response property being being the requests.Response object in the case of any error, so that the implementer can access it by catching the exception, and thus design their own custom logic around different types of error responses.

    @@ -1265,7 +1310,7 @@

    Errors
    Parameters

    method – Method being decorated. Must take one positional argument after self that is the URL/path to the resource, and must return an -object of class requests.Response, and be named after the HTTP method +object of class requests.Response, and be named after the HTTP method but with “r” prepended.

    Returns
    @@ -1321,7 +1366,7 @@

    Errors

    JSON-decode a response body and raise PDClientError if it fails.

    Parameters
    -

    rrequests.Response object

    +

    rrequests.Response object

    @@ -1330,6 +1375,11 @@

    Errors

    Changelog

    +

    2020-02-04: Version 4.0

    +
      +
    • Added support for using OAuth 2 access tokens to authenticate (#23 <https://github.com/PagerDuty/pdpyras/issues/23>)

    • +
    • Added a property that indicates the access level/scope of a given API credential (#22 <https://github.com/PagerDuty/pdpyras/issues/22>)

    • +

    2020-01-10: version 3.2.1

    • Fixed bug in APISession.trunc_token; property name typo causes AttributeError

    • @@ -1423,6 +1473,7 @@

      Table of Contents

    • Installation
    • Usage Guide
      • Basic Usage
      • +
      • Using an OAuth 2 Access Token to Authenticate
      • General Concepts
        • URLs
        • Request and Response Bodies
        • diff --git a/docs/objects.inv b/docs/objects.inv index 1c986a0..f1f86ef 100644 Binary files a/docs/objects.inv and b/docs/objects.inv differ diff --git a/docs/py-modindex.html b/docs/py-modindex.html index 71010fa..7e1e9c5 100644 --- a/docs/py-modindex.html +++ b/docs/py-modindex.html @@ -4,7 +4,7 @@ - Python Module Index — PagerDuty Python REST API Sessions 3.2.1 documentation + Python Module Index — PagerDuty Python REST API Sessions 4.0 documentation diff --git a/docs/search.html b/docs/search.html index 562073e..13a4fa9 100644 --- a/docs/search.html +++ b/docs/search.html @@ -4,7 +4,7 @@ - Search — PagerDuty Python REST API Sessions 3.2.1 documentation + Search — PagerDuty Python REST API Sessions 4.0 documentation diff --git a/docs/searchindex.js b/docs/searchindex.js index 1b4e158..79dc07c 100644 --- a/docs/searchindex.js +++ b/docs/searchindex.js @@ -1 +1 @@ -Search.setIndex({docnames:["index"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,"sphinx.ext.intersphinx":1,"sphinx.ext.todo":2,sphinx:56},filenames:["index.rst"],objects:{"":{pdpyras:[0,0,0,"-"]},"pdpyras.APISession":{api_call_counts:[0,2,1,""],api_time:[0,2,1,""],default_from:[0,2,1,""],default_page_size:[0,2,1,""],dict_all:[0,3,1,""],find:[0,3,1,""],iter_all:[0,3,1,""],list_all:[0,3,1,""],postprocess:[0,3,1,""],prepare_headers:[0,3,1,""],profiler_key:[0,3,1,""],rdelete:[0,3,1,""],rget:[0,3,1,""],rpost:[0,3,1,""],rput:[0,3,1,""],set_api_key:[0,3,1,""],subdomain:[0,3,1,""],total_call_count:[0,3,1,""],total_call_time:[0,3,1,""],trunc_token:[0,3,1,""],url:[0,2,1,""]},"pdpyras.EventsAPISession":{acknowledge:[0,3,1,""],prepare_headers:[0,3,1,""],resolve:[0,3,1,""],send_event:[0,3,1,""],set_api_key:[0,3,1,""],trigger:[0,3,1,""]},"pdpyras.PDClientError":{response:[0,2,1,""]},"pdpyras.PDSession":{api_key:[0,3,1,""],log:[0,2,1,""],max_http_attempts:[0,2,1,""],max_network_attempts:[0,2,1,""],parent:[0,2,1,""],postprocess:[0,3,1,""],prepare_headers:[0,3,1,""],raise_if_http_error:[0,2,1,""],request:[0,3,1,""],retry:[0,2,1,""],set_api_key:[0,3,1,""],sleep_timer:[0,2,1,""],sleep_timer_base:[0,2,1,""],stagger_cooldown:[0,3,1,""],trunc_key:[0,3,1,""],user_agent:[0,3,1,""]},pdpyras:{APISession:[0,1,1,""],EventsAPISession:[0,1,1,""],PDClientError:[0,1,1,""],PDSession:[0,1,1,""],auto_json:[0,4,1,""],last_4:[0,4,1,""],object_type:[0,4,1,""],raise_on_error:[0,4,1,""],random:[0,4,1,""],resource_envelope:[0,4,1,""],resource_name:[0,4,1,""],tokenize_url_path:[0,4,1,""],try_decoding:[0,4,1,""]}},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","attribute","Python attribute"],"3":["py","method","Python method"],"4":["py","function","Python function"]},objtypes:{"0":"py:module","1":"py:class","2":"py:attribute","3":"py:method","4":"py:function"},terms:{"0123456789abcdef0123456789abcdef":0,"101st":0,"201st":0,"break":0,"case":0,"catch":0,"class":0,"default":0,"final":0,"import":0,"int":0,"new":0,"return":0,"super":0,"transient":0,"true":0,"try":0,"while":0,AND:0,Added:0,BUT:0,FOR:0,For:0,IDs:0,NOT:0,Not:0,One:0,THE:0,The:0,There:0,These:0,USE:0,Useful:0,WITH:0,Will:0,With:0,_all:0,_api_kei:0,abbrevi:0,abc123:0,abov:0,absolut:0,accept:0,accord:0,account:0,acknowledg:0,action:0,add:0,added:0,adding:0,addit:0,address:0,adjust:0,admin:0,advanc:0,advantag:0,affect:0,after:0,against:0,agent:0,alert:0,algorithm:0,all:0,allow:0,along:0,alreadi:0,also:0,alter:0,altern:0,although:0,altogeth:0,alwai:0,amount:0,analyt:0,ani:0,anoth:0,api_call_count:0,api_kei:0,api_tim:0,api_token:0,apisess:0,append:0,appli:0,applic:0,approach:0,appropri:0,argument:0,aris:0,around:0,arrai:0,assert:0,assign:0,associ:0,assum:0,asynchron:0,attempt:0,attribut:0,attributeerror:0,author:0,auto:0,auto_json:0,automat:0,avail:0,avoid:0,back:0,base:0,baseurl:0,basi:0,becaus:0,becom:0,been:0,befor:0,begin:0,behav:0,behavior:0,being:0,beta:0,between:0,bit:0,bob:0,bonu:0,bool:0,born:0,both:0,brief:0,bug:0,bulk:0,bulletproof:0,busi:0,call:0,callabl:0,can:0,cannot:0,captur:0,care:0,carri:0,caus:0,cautiou:0,certain:0,chang:0,charact:0,charg:0,check:0,child:0,claim:0,classifi:0,code:0,colon:0,com:0,commit:0,common:0,commonli:0,commun:0,compar:0,comparison:0,compil:0,complet:0,comput:0,concurr:0,condit:0,conduc:0,confer:0,configur:0,conjunct:0,connect:0,consequ:0,consid:0,consist:0,constitut:0,constrain:0,construct:0,constructor:0,contact_method:0,contain:0,content:0,contract:0,conveni:0,cooldown:0,copi:0,correspond:0,could:0,count:0,coverag:0,creation:0,critic:0,current:0,custom:0,custom_detail:0,damag:0,dav:0,dave:0,david:0,deal:0,decod:0,decor:0,dedup:0,dedup_kei:0,dedupl:0,deem:0,def:0,default_from:0,default_page_s:0,defin:0,delai:0,demitri:0,departur:0,depend:0,deriv:0,descript:0,design:0,desir:0,detail:0,determin:0,dict:0,dict_al:0,dictionari:0,differ:0,directli:0,directori:0,disabl:0,discov:0,displai:0,distinct:0,distinguish:0,distribut:0,doc:0,document:0,doe:0,doesn:0,don:0,done:0,download:0,due:0,duplic:0,dure:0,dusti:0,each:0,easi:0,easier:0,easili:0,effect:0,effici:0,effort:0,either:0,elabor:0,elif:0,elimin:0,els:0,email:0,encapsul:0,enclos:0,encod:0,encount:0,end:0,enforc:0,ensur:0,entiti:0,entri:0,envelop:0,equal:0,escal:0,escalation_polici:0,essenti:0,etc:0,eventsapisess:0,ever:0,everyth:0,exact:0,exactli:0,exampl:0,example35:0,except:0,exist:0,exit:0,expect:0,experiment:0,express:0,extend:0,factor:0,fail:0,failur:0,fals:0,far:0,faulti:0,fetch:0,few:0,file:0,filter:0,find:0,finish:0,fire:0,first:0,first_100_dav:0,fit:0,fix:0,flow:0,focu:0,follow:0,followup:0,format:0,forward:0,found:0,four:0,free:0,frequent:0,from:0,full:0,fulli:0,furnish:0,further:0,furthermor:0,get:0,getter:0,github:0,give:0,given:0,global:0,goal:0,going:0,grant:0,greater:0,halt:0,happen:0,hard:0,has:0,have:0,header:0,help:0,herd:0,here:0,herebi:0,higher:0,hoc:0,holder:0,hook:0,how:0,howev:0,human:0,hundr:0,identif:0,identifi:0,ignor:0,imag:0,immedi:0,impact:0,implement:0,impli:0,incid:0,incident_refer:0,includ:0,inclus:0,incorrect:0,increas:0,increment:0,indefinit:0,index:0,individu:0,infinit:0,inform:0,inherit:0,initi:0,innermost:0,input:0,insensit:0,insert:0,instanc:0,instanti:0,instead:0,insul:0,integr:0,intend:0,intern:0,interrupt:0,interv:0,introduc:0,introduct:0,invok:0,isinst:0,issu:0,item:0,item_hook:0,iter_al:0,its:0,itself:0,jane:0,jget:0,job:0,jpost:0,jput:0,json:0,just:0,kei:0,key1:0,key2:0,keyerror:0,keyword:0,kind:0,kwarg:0,last:0,last_4:0,later:0,lead:0,leav:0,length:0,let:0,liabil:0,liabl:0,librari:0,licens:0,lies:0,light:0,like:0,limit:0,link:0,list:0,list_al:0,littl:0,local:0,log:0,log_entri:0,logger:0,login:0,longer:0,lower:0,made:0,mai:0,make:0,mani:0,manual:0,match:0,max_http_attempt:0,max_network_attempt:0,maximum:0,mean:0,member:0,merchant:0,merg:0,messag:0,metadata:0,method:0,metric:0,minim:0,minimum:0,mirror:0,mit:0,modif:0,modifi:0,modul:0,more:0,moreov:0,morgan:0,most:0,multipl:0,must:0,name:0,namespac:0,natur:0,necess:0,need:0,nest:0,net:0,network:0,next:0,node:0,non:0,none:0,noninfring:0,nonzero:0,note:0,notebook:0,noth:0,notic:0,notification_rul:0,now:0,number:0,obj_typ:0,object:0,object_typ:0,obtain:0,obvious:0,occur:0,odd:0,offset:0,old:0,omit:0,one:0,onli:0,onu:0,oper:0,option:0,order:0,origin:0,other:0,otherwis:0,our:0,ourselv:0,out:0,over:0,overal:0,overkil:0,overrid:0,own:0,pabc123:0,page:0,page_s:0,pagin:0,parallel:0,param:0,paramet:0,parent:0,part:0,particular:0,pass:0,path:0,pattern:0,paus:0,payload:0,pdclienterror:0,pdef456:0,pdsession:0,per:0,perform:0,permiss:0,permit:0,permitted_method:0,persist:0,person:0,pertain:0,phij789:0,pi86now:0,pip:0,pjkl678:0,place:0,plain:0,pleas:0,plu:0,pnoexst:0,polici:0,pool:0,portion:0,posit:0,possibl:0,post:0,postprocess:0,potenti:0,power:0,practic:0,pre:0,preced:0,predict:0,prepare_head:0,prepend:0,prerequisit:0,presenc:0,present:0,previou:0,print:0,prioriti:0,problem:0,process:0,profil:0,profiler_kei:0,program:0,progress:0,project:0,promote_to_admin:0,properti:0,provid:0,publish:0,pull:0,purpos:0,put:0,pzyx321:0,queri:0,question:0,r_name:0,rais:0,raise_if_http_error:0,raise_on_error:0,random:0,rang:0,rank:0,rate:0,rather:0,rdelet:0,readabl:0,real:0,reason:0,reattempt:0,receiv:0,recommend:0,record:0,refactor:0,refer:0,reform:0,regress:0,reinvent:0,rel:0,remov:0,renam:0,repeat:0,repetit:0,replac:0,report:0,repositori:0,repres:0,reproduc:0,reqeust:0,requir:0,rescind:0,resolv:0,resourc:0,resource_envelop:0,resource_nam:0,respect:0,respond:0,restrict:0,result:0,retriev:0,reusabl:0,rget:0,right:0,role:0,root:0,rout:0,routing_kei:0,rpost:0,rput:0,rule:0,safeguard:0,sai:0,same:0,sane:0,save:0,schema:0,search:0,second:0,secret:0,secur:0,see:0,self:0,sell:0,send:0,send_ev:0,seri:0,serial:0,serv:0,server:0,servic:0,session_id:0,set:0,set_api_kei:0,setter:0,sever:0,shall:0,shift:0,should:0,similar:0,similarli:0,simpl:0,simpler:0,simpli:0,simultan:0,singl:0,size:0,skip:0,slash:0,sleep:0,sleep_tim:0,sleep_timer_bas:0,small:0,softwar:0,some:0,someth:0,sort:0,sought:0,sourc:0,specif:0,specifi:0,spent:0,stagger_cooldown:0,standard:0,start:0,state:0,statu:0,status:0,status_cod:0,still:0,str:0,string:0,strip:0,structur:0,subdomain:0,subject:0,sublicens:0,submit:0,substanti:0,success:0,successfulli:0,succinct:0,succinctli:0,suffix:0,summari:0,superpow:0,supersed:0,supplement:0,suppli:0,sure:0,synchron:0,system:0,take:0,taken:0,task:0,tear:0,tediou:0,test:0,test_pdpyra:0,than:0,thei:0,them:0,themselv:0,thi:0,thing:0,third:0,thread:0,three:0,through:0,throught:0,thu:0,thunder:0,time:0,timer:0,token:0,tokenize_url_path:0,toler:0,too:0,tool:0,top:0,tort:0,total:0,total_call_count:0,total_call_tim:0,transform:0,transmit:0,treat:0,trigger:0,trunc_kei:0,trunc_token:0,truncat:0,try_decod:0,tupl:0,turn:0,two:0,type:0,typo:0,uid:0,ultim:0,unauthor:0,under:0,underli:0,uniformli:0,uniqu:0,unless:0,unpack:0,unspecifi:0,unsupport:0,until:0,unwrap:0,updated_incid:0,updated_us:0,upon:0,upper:0,uri:0,urllib3:0,use:0,used:0,user:0,user_ag:0,user_id:0,user_refer:0,user_sess:0,uses:0,using:0,usual:0,valid:0,valu:0,value1:0,value2:0,verb:0,veri:0,version:0,versu:0,via:0,wai:0,wait:0,want:0,wasn:0,web:0,welcom:0,well:0,went:0,were:0,what:0,wheel:0,when:0,whenev:0,where:0,wherea:0,whether:0,which:0,whichev:0,whitelist:0,whole:0,whom:0,whose:0,wise:0,within:0,without:0,word:0,work:0,would:0,wrap:0,write:0,wrong:0,yet:0,yield:0,you:0,your:0,yuck:0,zero:0},titles:["PDPYRAS: PagerDuty Python REST API Sessions"],titleterms:{"abstract":0,"function":0,Using:0,about:0,access:0,api:0,basic:0,bodi:0,changelog:0,client:0,concept:0,contribut:0,copyright:0,creat:0,data:0,delet:0,develop:0,disclaim:0,endpoint:0,error:0,event:0,featur:0,gener:0,guid:0,handl:0,histori:0,http:0,instal:0,interfac:0,iter:0,logic:0,manag:0,multi:0,pagerduti:0,pdpyra:0,python:0,read:0,regard:0,request:0,respons:0,rest:0,retri:0,session:0,special:0,support:0,updat:0,url:0,usag:0,warranti:0}}) \ No newline at end of file +Search.setIndex({docnames:["index"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,"sphinx.ext.intersphinx":1,"sphinx.ext.todo":2,sphinx:56},filenames:["index.rst"],objects:{"":{pdpyras:[0,0,0,"-"]},"pdpyras.APISession":{after_set_api_key:[0,2,1,""],api_call_counts:[0,3,1,""],api_time:[0,3,1,""],auth_header:[0,2,1,""],auth_type:[0,2,1,""],default_from:[0,3,1,""],default_page_size:[0,3,1,""],dict_all:[0,2,1,""],find:[0,2,1,""],iter_all:[0,2,1,""],list_all:[0,2,1,""],postprocess:[0,2,1,""],prepare_headers:[0,2,1,""],profiler_key:[0,2,1,""],rdelete:[0,2,1,""],rget:[0,2,1,""],rpost:[0,2,1,""],rput:[0,2,1,""],subdomain:[0,2,1,""],total_call_count:[0,2,1,""],total_call_time:[0,2,1,""],trunc_token:[0,2,1,""],url:[0,3,1,""]},"pdpyras.EventsAPISession":{acknowledge:[0,2,1,""],auth_header:[0,2,1,""],prepare_headers:[0,2,1,""],resolve:[0,2,1,""],send_event:[0,2,1,""],trigger:[0,2,1,""]},"pdpyras.PDClientError":{response:[0,3,1,""]},"pdpyras.PDSession":{after_set_api_key:[0,2,1,""],api_key:[0,2,1,""],api_key_access:[0,2,1,""],auth_header:[0,2,1,""],log:[0,3,1,""],max_http_attempts:[0,3,1,""],max_network_attempts:[0,3,1,""],parent:[0,3,1,""],postprocess:[0,2,1,""],prepare_headers:[0,2,1,""],raise_if_http_error:[0,3,1,""],request:[0,2,1,""],retry:[0,3,1,""],set_api_key:[0,2,1,""],sleep_timer:[0,3,1,""],sleep_timer_base:[0,3,1,""],stagger_cooldown:[0,2,1,""],trunc_key:[0,2,1,""]},pdpyras:{APISession:[0,1,1,""],EventsAPISession:[0,1,1,""],PDClientError:[0,1,1,""],PDSession:[0,1,1,""],auto_json:[0,4,1,""],last_4:[0,4,1,""],object_type:[0,4,1,""],raise_on_error:[0,4,1,""],random:[0,4,1,""],resource_envelope:[0,4,1,""],resource_name:[0,4,1,""],tokenize_url_path:[0,4,1,""],try_decoding:[0,4,1,""]}},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"],"3":["py","attribute","Python attribute"],"4":["py","function","Python function"]},objtypes:{"0":"py:module","1":"py:class","2":"py:method","3":"py:attribute","4":"py:function"},terms:{"0123456789abcdef0123456789abcdef":0,"101st":0,"201st":0,"break":0,"case":0,"catch":0,"class":0,"default":0,"final":0,"import":0,"int":0,"new":0,"return":0,"super":0,"transient":0,"true":0,"try":0,"while":0,AND:0,Added:0,BUT:0,FOR:0,For:0,IDs:0,NOT:0,Not:0,One:0,THE:0,The:0,There:0,These:0,USE:0,Useful:0,WITH:0,Will:0,With:0,_all:0,_api_kei:0,abbrevi:0,abc123:0,abov:0,absolut:0,accept:0,accord:0,account:0,acknowledg:0,action:0,add:0,added:0,adding:0,addit:0,address:0,adjust:0,admin:0,administr:0,advanc:0,advantag:0,affect:0,after:0,after_set_api_kei:0,against:0,agent:0,alert:0,algorithm:0,all:0,allow:0,along:0,alreadi:0,also:0,alter:0,altern:0,although:0,altogeth:0,alwai:0,amount:0,analyt:0,ani:0,anoth:0,api_call_count:0,api_kei:0,api_key_access:0,api_tim:0,api_token:0,apisess:0,append:0,appli:0,applic:0,approach:0,appropri:0,argument:0,aris:0,around:0,arrai:0,assert:0,assign:0,associ:0,assum:0,asynchron:0,attempt:0,attribut:0,attributeerror:0,auth_head:0,auth_typ:0,author:0,auto:0,auto_json:0,automat:0,avail:0,avoid:0,back:0,base:0,baseurl:0,basi:0,bearer:0,becaus:0,becom:0,been:0,befor:0,begin:0,behav:0,behavior:0,being:0,beta:0,between:0,bit:0,bob:0,bonu:0,bool:0,born:0,both:0,brief:0,bug:0,bulk:0,bulletproof:0,busi:0,call:0,callabl:0,can:0,cannot:0,captur:0,care:0,carri:0,caus:0,cautiou:0,certain:0,chang:0,charact:0,charg:0,check:0,child:0,claim:0,classifi:0,code:0,colon:0,com:0,commit:0,common:0,commonli:0,commun:0,compar:0,comparison:0,compil:0,complet:0,comput:0,concurr:0,condit:0,conduc:0,confer:0,configur:0,conjunct:0,connect:0,consequ:0,consid:0,consist:0,constitut:0,constrain:0,construct:0,constructor:0,contact_method:0,contain:0,content:0,contract:0,conveni:0,cooldown:0,copi:0,correspond:0,could:0,count:0,coverag:0,creation:0,credenti:0,critic:0,current:0,custom:0,custom_detail:0,damag:0,dav:0,dave:0,david:0,deal:0,decod:0,decor:0,dedup:0,dedup_kei:0,dedupl:0,deem:0,def:0,default_from:0,default_page_s:0,defin:0,delai:0,demitri:0,departur:0,depend:0,deprec:0,deriv:0,descript:0,design:0,desir:0,detail:0,determin:0,dict:0,dict_al:0,dictionari:0,differ:0,directli:0,directori:0,disabl:0,discov:0,displai:0,distinct:0,distinguish:0,distribut:0,doc:0,document:0,doe:0,doesn:0,don:0,done:0,download:0,due:0,duplic:0,dure:0,dusti:0,each:0,easi:0,easier:0,easili:0,effect:0,effici:0,effort:0,either:0,elabor:0,elif:0,elimin:0,els:0,email:0,encapsul:0,enclos:0,encod:0,encount:0,end:0,enforc:0,ensur:0,entiti:0,entri:0,envelop:0,equal:0,escal:0,escalation_polici:0,essenti:0,etc:0,eventsapisess:0,ever:0,everyth:0,exact:0,exactli:0,exampl:0,example35:0,except:0,exist:0,exit:0,expect:0,experiment:0,express:0,extend:0,factor:0,fail:0,failur:0,fals:0,far:0,faulti:0,fetch:0,few:0,file:0,filter:0,find:0,finish:0,fire:0,first:0,first_100_dav:0,fit:0,fix:0,flow:0,focu:0,follow:0,followup:0,format:0,forward:0,found:0,four:0,free:0,frequent:0,from:0,full:0,fulli:0,furnish:0,further:0,furthermor:0,get:0,getter:0,github:0,give:0,given:0,global:0,goal:0,going:0,grant:0,greater:0,halt:0,happen:0,hard:0,has:0,have:0,header:0,help:0,herd:0,here:0,herebi:0,higher:0,hoc:0,holder:0,hook:0,how:0,howev:0,human:0,hundr:0,identif:0,identifi:0,ignor:0,imag:0,immedi:0,impact:0,implement:0,impli:0,incid:0,incident_refer:0,includ:0,inclus:0,incorrect:0,increas:0,increment:0,indefinit:0,index:0,indic:0,individu:0,infinit:0,inform:0,inherit:0,initi:0,innermost:0,input:0,insensit:0,insert:0,instanc:0,instanti:0,instead:0,insul:0,integr:0,intend:0,intern:0,interrupt:0,interv:0,introduc:0,introduct:0,invok:0,isinst:0,issu:0,item:0,item_hook:0,iter_al:0,its:0,itself:0,jane:0,jget:0,job:0,jpost:0,jput:0,json:0,just:0,kei:0,key1:0,key2:0,keyerror:0,keyword:0,kind:0,kwarg:0,last:0,last_4:0,later:0,lead:0,leav:0,length:0,let:0,level:0,liabil:0,liabl:0,librari:0,licens:0,lies:0,light:0,like:0,limit:0,link:0,list:0,list_al:0,littl:0,local:0,log:0,log_entri:0,logger:0,login:0,longer:0,lower:0,made:0,mai:0,make:0,mani:0,manual:0,match:0,max_http_attempt:0,max_network_attempt:0,maximum:0,mean:0,member:0,memoiz:0,merchant:0,merg:0,messag:0,metadata:0,method:0,metric:0,minim:0,minimum:0,mirror:0,mit:0,modif:0,modifi:0,modul:0,more:0,moreov:0,morgan:0,most:0,multipl:0,must:0,name:0,namespac:0,natur:0,necess:0,need:0,nest:0,net:0,network:0,next:0,node:0,non:0,none:0,noninfring:0,nonzero:0,note:0,notebook:0,noth:0,notic:0,notification_rul:0,now:0,number:0,oauth2:0,oauth_token_her:0,obj_typ:0,object:0,object_typ:0,obtain:0,obvious:0,occur:0,odd:0,offici:0,offset:0,old:0,omit:0,one:0,onli:0,onu:0,oper:0,option:0,order:0,origin:0,other:0,otherwis:0,our:0,ourselv:0,out:0,outsid:0,over:0,overal:0,overkil:0,overrid:0,own:0,pabc123:0,page:0,page_s:0,pagin:0,parallel:0,param:0,paramet:0,parent:0,part:0,particular:0,pass:0,path:0,pattern:0,paus:0,payload:0,pdclienterror:0,pdef456:0,pdsession:0,per:0,perform:0,permiss:0,permit:0,permitted_method:0,persist:0,person:0,pertain:0,phij789:0,pi86now:0,pip:0,pjkl678:0,pkce:0,place:0,plain:0,pleas:0,plu:0,pnoexst:0,polici:0,pool:0,portion:0,posit:0,possibl:0,post:0,postprocess:0,potenti:0,power:0,practic:0,pre:0,preced:0,predict:0,prepare_head:0,prepend:0,prerequisit:0,presenc:0,present:0,previou:0,print:0,prioriti:0,problem:0,process:0,profil:0,profiler_kei:0,program:0,progress:0,project:0,promote_to_admin:0,properti:0,provid:0,publish:0,pull:0,purpos:0,purview:0,put:0,pzyx321:0,queri:0,question:0,r_name:0,rais:0,raise_if_http_error:0,raise_on_error:0,random:0,rang:0,rank:0,rate:0,rather:0,rdelet:0,readabl:0,real:0,reason:0,reattempt:0,receiv:0,recommend:0,record:0,refactor:0,refer:0,reform:0,regress:0,reinvent:0,rel:0,remov:0,renam:0,repeat:0,repetit:0,replac:0,report:0,repositori:0,repres:0,reproduc:0,reqeust:0,requir:0,rescind:0,resolv:0,resourc:0,resource_envelop:0,resource_nam:0,respect:0,respond:0,restrict:0,result:0,retriev:0,reusabl:0,rget:0,right:0,role:0,root:0,rout:0,routing_kei:0,rpost:0,rput:0,rule:0,safeguard:0,sai:0,same:0,sane:0,save:0,schema:0,scope:0,search:0,second:0,secret:0,secur:0,see:0,self:0,sell:0,send:0,send_ev:0,separ:0,seri:0,serial:0,serv:0,server:0,servic:0,session_id:0,set:0,set_api_kei:0,setter:0,sever:0,shall:0,shift:0,should:0,similar:0,similarli:0,simpl:0,simpler:0,simpli:0,simultan:0,singl:0,size:0,skip:0,slash:0,sleep:0,sleep_tim:0,sleep_timer_bas:0,small:0,softwar:0,some:0,someth:0,sort:0,sought:0,sourc:0,specif:0,specifi:0,spent:0,stagger_cooldown:0,standard:0,start:0,state:0,statu:0,status:0,status_cod:0,step:0,still:0,str:0,string:0,strip:0,structur:0,subdomain:0,subject:0,sublicens:0,submit:0,substanti:0,success:0,successfulli:0,succinct:0,succinctli:0,suffix:0,summari:0,superpow:0,supersed:0,supplement:0,suppli:0,sure:0,synchron:0,system:0,take:0,taken:0,task:0,tear:0,tediou:0,tell:0,test:0,test_pdpyra:0,than:0,thei:0,them:0,themselv:0,thi:0,thing:0,third:0,thread:0,three:0,through:0,throught:0,thu:0,thunder:0,time:0,timer:0,tokenize_url_path:0,toler:0,too:0,tool:0,top:0,tort:0,total:0,total_call_count:0,total_call_tim:0,transform:0,transmit:0,treat:0,trigger:0,trunc_kei:0,trunc_token:0,truncat:0,try_decod:0,tupl:0,turn:0,two:0,type:0,typo:0,uid:0,ultim:0,unauthor:0,under:0,underli:0,uniformli:0,uniqu:0,unless:0,unpack:0,unspecifi:0,unsupport:0,until:0,unwrap:0,updated_incid:0,updated_us:0,upon:0,upper:0,uri:0,urllib3:0,use:0,used:0,user:0,user_id:0,user_refer:0,user_sess:0,uses:0,using:0,usual:0,valid:0,valu:0,value1:0,value2:0,verb:0,veri:0,version:0,versu:0,via:0,wai:0,wait:0,want:0,wasn:0,web:0,welcom:0,well:0,went:0,were:0,what:0,wheel:0,when:0,whenev:0,where:0,wherea:0,whether:0,which:0,whichev:0,whitelist:0,whole:0,whom:0,whose:0,wise:0,within:0,without:0,word:0,work:0,would:0,wrap:0,write:0,wrong:0,yet:0,yield:0,you:0,your:0,yuck:0,zero:0},titles:["PDPYRAS: PagerDuty Python REST API Sessions"],titleterms:{"abstract":0,"function":0,Using:0,about:0,access:0,api:0,authent:0,basic:0,bodi:0,changelog:0,client:0,concept:0,contribut:0,copyright:0,creat:0,data:0,delet:0,develop:0,disclaim:0,endpoint:0,error:0,event:0,featur:0,gener:0,guid:0,handl:0,histori:0,http:0,instal:0,interfac:0,iter:0,logic:0,manag:0,multi:0,oauth:0,pagerduti:0,pdpyra:0,python:0,read:0,regard:0,request:0,respons:0,rest:0,retri:0,session:0,special:0,support:0,token:0,updat:0,url:0,usag:0,warranti:0}}) \ No newline at end of file diff --git a/pdpyras.py b/pdpyras.py index a556a25..0c81f66 100644 --- a/pdpyras.py +++ b/pdpyras.py @@ -18,7 +18,7 @@ else: string_types = basestring -__version__ = '3.2.1' +__version__ = '4.0' # These are API resource endpoints/methods for which multi-update is supported @@ -453,7 +453,7 @@ def request(self, method, url, **kwargs): base URL will be prepended. :param \*\*kwargs: Additional keyword arguments to pass to `requests.Session.request - `_ + `_ :type method: str :type url: str :returns: the HTTP response object @@ -594,7 +594,6 @@ def trunc_key(self): @property def user_agent(self): - """Unique user-agent header for making requests""" return 'pdpyras/%s python-requests/%s Python/%d.%d'%( __version__, requests.__version__, diff --git a/setup.py b/setup.py index 0d0afeb..2e62efb 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -__version__ = '3.2.1' +__version__ = '4.0' if __name__ == '__main__': setup(