# Using Python to programmatically create 100 groups

**URL:** <https://meta.discourse.org/t/using-python-to-programmatically-create-100-groups/269793>\
**Category:** Development\
**Created:** [June 27, 2023, 4:15pm UTC](https://meta.discourse.org/t/using-python-to-programmatically-create-100-groups/269793 "2023-06-27T16:15:55Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [June 27, 2023, 8:12pm UTC](https://meta.discourse.org/t/using-python-to-programmatically-create-100-groups/269793/3 "2023-06-27T20:12:01Z")

</div>

Something like this:

```ruby
group_names.each do |name|
  begin
  response = client.create_group(name: name,
    visibility_level: 0,
    members_visibility_level: 0,
    mentionable_level: 3,
    messageable_level: 3,
    public_exit: true,
    public_admission: true
  )
  group_id = response["basic_group"]["id"]
  group_name =response["basic_group"]["name"]
  puts "Created #{group_name}(#{group_id})"
  sleep 1
rescue => e
  puts "oops. Had a problem with #{name} #{e}"
  sleep 1
end

```

---

_[View the full topic](https://meta.discourse.org/t/using-python-to-programmatically-create-100-groups/269793)._
