Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def get_cert():
- import json, requests
- r = requests.get('https://certstream.calidog.io/example.json')
- return r.json()
- def send_message(msg):
- import json
- from kafka import KafkaProducer
- producer = KafkaProducer(
- bootstrap_servers="localhost:9092",
- value_serializer=lambda x: json.dumps(x).encode('utf-8')
- )
- return producer.send('CertStream', msg)
- In [12]: msg = get_cert()
- In [13]: rps = send_message(msg)
- In [14]: dir(rps)
- Out[14]:
- ['__class__',
- '__delattr__',
- '__dict__',
- '__dir__',
- '__doc__',
- '__eq__',
- '__format__',
- '__ge__',
- '__getattribute__',
- '__gt__',
- '__hash__',
- '__init__',
- '__init_subclass__',
- '__le__',
- '__lt__',
- '__module__',
- '__ne__',
- '__new__',
- '__reduce__',
- '__reduce_ex__',
- '__repr__',
- '__setattr__',
- '__sizeof__',
- '__str__',
- '__subclasshook__',
- '__weakref__',
- '_call_backs',
- '_callbacks',
- '_errbacks',
- '_produce_future',
- '_produce_success',
- 'add_both',
- 'add_callback',
- 'add_errback',
- 'args',
- 'chain',
- 'error_on_callbacks',
- 'exception',
- 'failed',
- 'failure',
- 'get',
- 'is_done',
- 'retriable',
- 'succeeded',
- 'success',
- 'value']
- In [16]: rps.is_done
- Out[16]: True
- In [18]: rps.succeeded()
- Out[18]: True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement