@@ -87,8 +87,11 @@ def parse_comment(body):
87
87
def send_comment (body , issue_api , to ):
88
88
create_event (to , 'send_comment' , body )
89
89
body = {'body' : '@{}: {}' .format (to , body )}
90
- url = '{}/comments?access_token={}' .format (issue_api , token )
91
- r = requests .post (url , json = body )
90
+ url = '{}/comments' .format (issue_api )
91
+ headers = {
92
+ 'Authorization' : 'token {}' .format (token ),
93
+ }
94
+ r = requests .post (url , json = body , headers = headers )
92
95
r .raise_for_status ()
93
96
print ('Sent comment: {}' .format (r .status_code ))
94
97
@@ -98,8 +101,11 @@ def send_comment(body, issue_api, to):
98
101
99
102
def get_comments (issue_api ):
100
103
body = {'since' : '1970-01-01T00:00:00Z' }
101
- url = '{}/comments?access_token={}' .format (issue_api , token )
102
- r = requests .get (url , json = body )
104
+ url = '{}/comments' .format (issue_api )
105
+ headers = {
106
+ 'Authorization' : 'token {}' .format (token ),
107
+ }
108
+ r = requests .get (url , json = body , headers = headers )
103
109
r .raise_for_status ()
104
110
return r .json ()
105
111
@@ -117,8 +123,11 @@ def create_issue(title, description, src_url, author):
117
123
description = '{}\n Requested by @{} in {}.' .format (description , author ,
118
124
src_url )
119
125
body = {'title' : title , 'body' : description }
120
- url = '{}/issues?access_token={}' .format (doc_repo_url , token )
121
- r = requests .post (url , json = body )
126
+ url = '{}/issues' .format (doc_repo_url )
127
+ headers = {
128
+ 'Authorization' : 'token {}' .format (token ),
129
+ }
130
+ r = requests .post (url , json = body , headers = headers )
122
131
r .raise_for_status ()
123
132
print ('Created issue: {}' .format (r .status_code ))
124
133
0 commit comments