Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7953f20

Browse files
Damodar DahalJon Wayne Parrott
Damodar Dahal
authored and
Jon Wayne Parrott
committed
Added headers manually to override error (GoogleCloudPlatform#791)
1 parent 30c4da0 commit 7953f20

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

appengine/standard/mailgun/main.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ def send_simple_message(recipient):
4646
'text': 'Test message from Mailgun'
4747
}
4848

49-
resp, content = http.request(url, 'POST', urlencode(data))
49+
resp, content = http.request(
50+
url, 'POST', urlencode(data),
51+
headers={"Content-Type": "application/x-www-form-urlencoded"})
5052

5153
if resp.status != 200:
5254
raise RuntimeError(
@@ -68,7 +70,9 @@ def send_complex_message(recipient):
6870
'html': '<html>HTML <strong>version</strong> of the body</html>'
6971
}
7072

71-
resp, content = http.request(url, 'POST', urlencode(data))
73+
resp, content = http.request(
74+
url, 'POST', urlencode(data),
75+
headers={"Content-Type": "application/x-www-form-urlencoded"})
7276

7377
if resp.status != 200:
7478
raise RuntimeError(

0 commit comments

Comments
 (0)