Skip to content

Send and receive SMS messages using your Android phone programmatically via a simple HTTP API

Add python code example in httpsms.com landing page

Acho Arnold33379906ab44
diff --git a/web/nuxt.config.js b/web/nuxt.config.js
index 4bd6d9a4..1f8660fd 100644
--- a/web/nuxt.config.js
+++ b/web/nuxt.config.js
@@ -160,4 +160,8 @@ export default {
// Build Configuration: https://go.nuxtjs.dev/config-build
build: {},
+
+ server: {
+ port: 30000, // default: 3000
+ },
}
diff --git a/web/pages/index.vue b/web/pages/index.vue
index 2ae1d23e..aad61d79 100644
--- a/web/pages/index.vue
+++ b/web/pages/index.vue
@@ -255,6 +255,12 @@
}}</v-icon>
PHP
</v-tab>
+ <v-tab href="#python">
+ <v-icon color="#ffffff" class="mr-2">{{
+ mdiLanguagePython
+ }}</v-icon>
+ Python
+ </v-tab>
<v-tab href="#go">
<v-icon color="#00aed8" class="mr-2">{{
mdiLanguageGo
@@ -323,6 +329,33 @@ $res = $client->request('POST', 'https://api.httpsms.com/v1/messages/send', [
]);
echo $res->getBody();
+</code>
+ </pre>
+ </v-tab-item>
+ <v-tab-item value="python">
+ <pre v-highlight class="python w-full mt-n2 mb-n13">
+<code>import requests
+import json
+
+api_key = "Get API Key from https://httpsms.com/settings"
+
+url = 'https://api.httpsms.com/v1/messages/send'
+
+headers = {
+ 'x-api-key': api_key,
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json'
+}
+
+payload = {
+ "content": "This is a sample text message",
+ "from": "+18005550199",
+ "to": "+18005550100"
+}
+
+response = requests.post(url, headers=headers, data=json.dumps(payload))
+
+print(response.json())
</code>
</pre>
</v-tab-item>
@@ -537,6 +570,7 @@ import {
mdiSend,
mdiForum,
mdiNumeric1,
+ mdiLanguagePython,
mdiNumeric2,
mdiNumeric3,
mdiTallyMark1,
@@ -567,6 +601,7 @@ export default Vue.extend({
mdiTallyMark3,
mdiLanguageJavascript,
mdiLanguagePhp,
+ mdiLanguagePython,
mdiLanguageCsharp,
mdiLanguageJava,
mdiPowershell,