{"id":13502737,"url":"https://github.com/rochacbruno-archive/pysendgrid","last_synced_at":"2026-02-15T14:31:56.010Z","repository":{"id":4088660,"uuid":"5195323","full_name":"rochacbruno-archive/pysendgrid","owner":"rochacbruno-archive","description":"Python module for interacting with sendgrid api","archived":false,"fork":false,"pushed_at":"2012-07-28T00:04:55.000Z","size":132,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-31T22:32:49.251Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rochacbruno-archive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-07-26T17:50:35.000Z","updated_at":"2019-07-26T16:53:40.000Z","dependencies_parsed_at":"2022-08-30T15:22:47.517Z","dependency_job_id":null,"html_url":"https://github.com/rochacbruno-archive/pysendgrid","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rochacbruno-archive%2Fpysendgrid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rochacbruno-archive%2Fpysendgrid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rochacbruno-archive%2Fpysendgrid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rochacbruno-archive%2Fpysendgrid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rochacbruno-archive","download_url":"https://codeload.github.com/rochacbruno-archive/pysendgrid/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224115710,"owners_count":17258238,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T22:02:23.771Z","updated_at":"2026-02-15T14:31:50.981Z","avatar_url":"https://github.com/rochacbruno-archive.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"pysendgrid\n==========\n\nPython module for interacting with sendgrid api\n\nRequirements\n------------\n\n* json\n* requests\n* csv\n\nFeatures\n--------\n\n## Sendgrid Newsletter API\n\n* Create a newsletter with name, subject and html body\n* Get a newsletter as json\n* Clone an existing newsletter for resending\n* Create recipient list\n* Get and search recipient lists\n* Add recipients (emails) in to recipient lists\n* Includes a recipient list in to a newsletter\n* Schedule a newsletter to be send imediatelly, with delay or at specific date\n* Get identities\n\n## Aditional features\n* Import recipients from CSV, clone a newsletter, split the list at given interval and sends the newsletter gradually to warm up the IP for ISPs \n\n\nHow to use\n----------\n\n```python\n\n# Create sendgrid object\n# pass in your credentials\n\nfrom pysendgrid import SendGrid\nsendgrid = SendGrid(\"you@domain.com\", \"yourpassword\")\n\n# create a new newsletter\n# name, subject, html\n\nsendgrid.add_newsletter(\"teste2\", \"testando apenas\", \"\u003chtml\u003e bla bla bla \u003c/html\u003e\")\n\n{u'message': u'success'}\n\n# clone an existing newsletter\n# existing_name, new_name\n\nsendgrid.clone_newsletter(\"teste2\", \"teste3\") \n\n{u'message': u'success'}\n\n# get a newsletter\n# newsletter_name\n\nsendgrid.get_newsletter(\"teste3\")\n\n{u'can_edit': True, u'name': u'teste3', u'text': u'\u003chtml\u003e bla bla bla \u003c/html\u003e',\nu'newsletter_id': 522082, u'total_recipients': 0, u'html': u'\u003chtml\u003e bla bla bla \u003c/html\u003e', u'type': u'html', u'date_schedule': 0,\nu'identity': u'mydomain.com', u'subject': u'testing'}\n\n# list all newsletters\n\nsendgrid.list_newsletter()\n\n[{u'can_edit': True, u'name': u'teste3', u'text': u'\u003chtml\u003e bla bla bla \u003c/html\u003e', \nu'newsletter_id': 522082, u'total_recipients': 0, u'html': u'\u003chtml\u003e bla bla bla \u003c/html\u003e', u'type': u'html', u'date_schedule': 0,\nu'identity': u'mydomain.com', u'subject': u'testing'},\n{u'can_edit': True, u'name': u'teste2', u'text': u'\u003chtml\u003e bla bla bla \u003c/html\u003e', \nu'newsletter_id': 522081, u'total_recipients': 0, u'html': u'\u003chtml\u003e bla bla bla \u003c/html\u003e', u'type': u'html', u'date_schedule': 0,\nu'identity': u'mydomain.com', u'subject': u'testing'},\n..., ...]\n\n# Create a recipient list\n# list_name\n\nsendgrid.add_list(\"potential_customers\")\n\n{u'message': u'success'}\n\n# Add emails (one by one) in to a recipient list\n# lista_name, recipent_data (must be a dict with name, email and aditional keys)\n\nperson = {\"name\": \"John\", \"email\": \"jon@jon.com\"}\nsendgrid.add_email_to(\"potential_customers\", **person)\n\n{u'inserted': 1}\n\n# add multiple emails in to a recipient list\n# list_name, list of recipients (a list of dicts)\npeople = [{\"name\": \"John\", \"email\": \"jon@jon.com\"}, {\"name\": \"Mary\", \"email\": \"mary@mary.com\"}]\n\nsendgrid.add_emails_to(\"potential_customers\", people)\n\n{u'inserted': 2}\n\n\n# Add a recipient list in to a newsletter\n# newsletter_name, list_name\n\nsendgrid.add_recipients(\"teste3\", \"potential_customers\")\n\n{u'message': u'success'}\n\n\n# Schedule a newsletter to be sent after 30 minutes\n# newsletter_name, delay in minutes\n\nsendgrid.add_schedule(\"teste3\", after=30)\n\n{u'message': u'success'}\n\n# schedule a newsletter to be sent in a specific date\n# newsletter_name, a datetime object\n\nimport datetime\nsend_date = datetime.datetime(2012, 01, 01)\nsendgrid.add_schedule(\"teste3\", at=send_date)\n\n{u'message': u'success'}\n\n# send a newsletter immediatelly\n# newsletter_name, ommiting date or delay will send immediatelly\n\nsendgrid.add_schedule(\"teste3\")\n\n{u'message': u'success'}\n\n# send a cloned newsletter to a list (.csv) of recipients\n# day by day, starting with 200 and increasing 200 each day\n# very useful for ISP warming\n\n# it will take a csv, with no header and in format name,email@domain.com\n# will split the csv in to lists starting by 200 and increasing by 200\n# exemple:\n# my_awesome_list_1: 200 recipients\n# my_awesome_list_2: 400 recipients\n# my_awesome_list_3: 600 recipients\n\n# calculate dates by your own\n# damm SendGrid does not support timezone\nsend_at = datetime.datetime(2012, 7, 30) + datetime.timedelta(hours=14)\nsendgrid.warm_up_from_csv(\"/path/to/csv_file.csv\",\n                           \"newsletter_to_be_cloned\",\n                           \"My_awesome_name_prefix\",\n                           interval=200,\n                           interval_step=200,\n                           start_send_at=send_at\n\t                       )\n \n# will print statuses and stores text file logs\n# TODO: use sqlite and DAL for status?\n```\n\n# TODO\n\n* calculate date to send (sendgrid does not support timezone)\n* implement delete methods\n* better docs\n* better exception handling\n* Map all Newsletter API methods\n* pack and distribute, send to PyPi\n* Tests\n* Import from excel file\n\n# Contribs\n* retry_on_exceptions decorator copied from https://github.com/fjsj/retry_on_exceptions/","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frochacbruno-archive%2Fpysendgrid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frochacbruno-archive%2Fpysendgrid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frochacbruno-archive%2Fpysendgrid/lists"}