Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Khemanorak Khath NorakGithub

🎯
Focusing
Block or report user

Report or block NorakGithub

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@NorakGithub
NorakGithub / sendgrid.py
Created May 27, 2019
SendGrid Python API Client for Sending Email
View sendgrid.py
import requests
class SendGrid:
def __init__(self, **kwargs):
self.api_key: str = kwargs.get('api_key')
self.subject: str = kwargs.get('subject')
self.sender: str = kwargs.get('sender')
self.receivers: [str] = kwargs.get('receivers')
self.content_type: str = kwargs.get('content_type', 'text/plain')
View gist:ee654299aecfdfd471bdbaf73198211a
>>> from ldap3 import Server, Connection, ALL
>>> server = Server('localhost', get_info=ALL)
>>> conn = Connection(server, 'cn=admin,dc=codium,dc=com', 'codium123', auto_bind=True)
>>> conn.search('dc=codium,dc=com', '(objectclass=person)')
True
>>> conn.entries
[DN: cn=Htet Naing Aung,ou=people,dc=codium,dc=com - STATUS: Read - READ TIME: 2016-12-27T21:23:11.662103
, DN: cn=Than Htike Aung,ou=people,dc=codium,dc=com - STATUS: Read - READ TIME: 2016-12-27T21:23:11.662241
]
>>> conn.add('cn=Noark,ou=people,dc=codium,dc=com', ['inetOrgPerson', 'organizationalPerson', 'person', 'top'], {'cn': 'Norak', 'sn': 'Khath', 'mail': 'norak@codium.com'})
You can’t perform that action at this time.