Skip to content

Instantly share code, notes, and snippets.

@timothycrosley
Last active June 27, 2017 09:46
Show Gist options
  • Save timothycrosley/7bde155d92922449acf5 to your computer and use it in GitHub Desktop.
Save timothycrosley/7bde155d92922449acf5 to your computer and use it in GitHub Desktop.
Seamlessly switch how communication happens
import os
import hug
import my_internal_hug_microservice
if os.environ.get('API_INTERFACE', None) == 'HTTP'::
internal_hug_microservice = hug.use.HTTP('http://localhost:8000/')
else:
internal_hug_microservice = hug.use.Local(my_internal_hug_microservice)
latest = my_internal_microservice.get('/latest_news').data
@frafra
Copy link

frafra commented Jun 27, 2017

It looks wrong. There are two columns at the end of line no. 7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment