Useful Python 2.7 script snippets

Python curl command script: (install pip tutorial and requests tutorial)

import requestsdef sendRequest():
url = 'yourEndPoint'
payload = {"action": "update",
"category": "Android"}
headers = {'Content-type': 'application/json'}
r = requests.post(url, json=payload, headers=headers)
print r

Python open browser:

import webbrowserdef open_Google_Play_Console():
webbrowser.open('https://google.com')

Python open file location:

import os
import sys
def open_BuildServerApps():
bashCommand = 'open /fileLocation/builds/android'
p= os.popen(bashCommand)
s=p.readline()
p.close()

software engineer, read, swim, travel. apps: https://goo.gl/rDuuQw https://goo.gl/15GvfE

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store