- Want to expose the Unifi console via a public domain like
unifi.mydomain.com
. - Theoretically if
unifi.ui.com
goes down this proxy would continue to work. - Also just good practice hackin'
Lateley at work, I've become invested in making sure that we only have one of things. In modern development, we are blessed with patterns that don't require instantiating expensive things, or not having to worry about creating them at all. But when working with service class instances which talk over the wire, it becomes imperative to enforce expensive operations only being done once, and moreover ensuring that multiple consumers of the same singleton don't duplicate requests.
I've found that the easiest way to ensure instantiation only occurs once (in browser contexts) is to use the window
.
Sometimes, it is useful to gather form data from a webpage en masse.
The quick-script way to do this is to iterate via document.forms
and construct FormData
objects for each form on the page.
// es6 spread converts fancy collection obj into plain array
const allForms = [...document.forms]
allForms.forEach((f) => {
const fd = new FormData(form)
{ | |
"tasks": [ | |
{ | |
"first_name": "", | |
"last_name": "", | |
"email": "", | |
"phone": "", | |
"address_1": "", | |
"address_2": "", |
A short guide on how to beat, fool, and trick Shopify bots and prevent them from checking out on your store.
-
Do not publish products live on the store until drop time. Loading a product live on the site and then quickly un-publishing it has already given away your product to bots and scrapers, which log every product that publishes on your site.
-
Do not add variants to your product until it is ready to go live. Similar to #1, loading variants of your product before release time gives them away to bots.
-
Cycle your API keys and credentials for any private app that you use. API keys allow for access to published and unpublished products. If they leak or are revealed, everyone will have backend access to your products. Cycle these often and before releases (before you draft your release products).
-
Enter password-mode on your storefront well before release time. This will allow any pre-generated checkout sessions to expire and level the playing field once your product releases and goes into a queue.
import requests | |
import urllib3 | |
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | |
class ProxyFinder: | |
def __init__(self): | |
self.username = 'XXX' | |
self.password = 'XXX' |
One of the projects I'm working on right now requires being able to upload product images to Shopify. These images
are sourced via Dropbox links, which look something like this: https://www.dropbox.com/s/[some id]/[filename].jpg?dl=0
.
Shopify has a feature which allows for API image uploads via URL or via a Base64 encoded attachment. However, when you try and link a Dropbox URL, you will likely encounter an error since Dropbox file extensions are "faux", and aren't the actual location of the image you want.
Searching for a solution to this yeilds little help. The common solution from Shopify indicates that you'd have to download
the images via your URL (to do this you must pass ?dl=1
), and either encode it to base64 or host it somewhere on your own,
then attach the image to your API request.
import requests | |
LISTINGURL = '' | |
VIEWS = 200 | |
def main(): | |
for i in range(VIEWS): | |
r = requests.get(LISTINGURL) | |
if __name__ == '__main__': |
import requests | |
import json | |
import threading | |
import csv | |
from datetime import datetime | |
from requests.packages.urllib3.exceptions import InsecureRequestWarning | |
requests.packages.urllib3.disable_warnings(InsecureRequestWarning) |