Skip to content

Instantly share code, notes, and snippets.

@timothycrosley
Last active June 27, 2017 09:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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
@eamonnfaherty
Copy link

Is this correct? internal_hug_microservice is declared on lines 8 and 10 but not used anywhere and my_internal_microservice does not seem be declared anywhere?

@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