Skip to content

Instantly share code, notes, and snippets.

@jacobSingh
Created June 14, 2021 15:50
Show Gist options
  • Save jacobSingh/224159d9eda57d748ce98ccddf4f0b07 to your computer and use it in GitHub Desktop.
Save jacobSingh/224159d9eda57d748ce98ccddf4f0b07 to your computer and use it in GitHub Desktop.
class Provider():
def getFollowers(username):
pass
class LinkedInProvider(Provider):
def __init__(self):
pass
class TwitterProvider(Provider):
api = None
def __init__(self, **kwargs):
self.api = Api(bearer_token=kwargs['bearer_token'])
pass
class ProviderFactory():
providers = {
'twitter': TwitterProvider,
'linkedIn': LinkedInProvider,
}
@classmethod
def factory(cls, name: str, **kwargs) -> 'FollowerGetter':
""" Factory command to create the executor """
provider_class = cls.providers[name]
provider = provider_class(**kwargs)
return provider
p = ProviderFactory.factory('twitter', bearer_token="foo")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment