This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
# from https://stackoverflow.com/a/35534695 | |
payload = [{"json": "array"}, {"another": "element"}] | |
headers = {'Content-Type': 'application/json', 'Accept':'application/json'} | |
requests.post(url,data=json.dumps(payload), headers=headers) | |
# In newer versions of requests | |
# from https://stackoverflow.com/a/35535240 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
# From: https://stackoverflow.com/a/30941292 | |
# Standard import | |
import importlib | |
# Load "module.submodule.MyClass" | |
MyClass = getattr(importlib.import_module("module.submodule"), "MyClass") | |
# Instantiate the class (pass arguments to the constructor, if needed) | |
instance = MyClass() | |
""" |
-
Curl to grab remote filename after following location
curl -O -J -L -g "https://path/to/complex/and/rare/url/"
NewerOlder