1
0
Fork 0

Merge branch 'pipenv'

This commit is contained in:
Ash Wilson 2017-10-20 21:04:55 -04:00
commit e0ef751878
3 changed files with 109 additions and 12 deletions

16
Pipfile Normal file
View File

@ -0,0 +1,16 @@
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[dev-packages]
[packages]
"beautifulsoup4" = "<5.0,>=4.4"
requests = "<3.0,>=2.5.3"
slacker = "*"

81
Pipfile.lock generated Normal file
View File

@ -0,0 +1,81 @@
{
"_meta": {
"hash": {
"sha256": "fa43013a07dab9dde382cd1764c8ca04fea2a84d0c77e26fac5b86e242a50b9b"
},
"host-environment-markers": {
"implementation_name": "cpython",
"implementation_version": "0",
"os_name": "posix",
"platform_machine": "x86_64",
"platform_python_implementation": "CPython",
"platform_release": "4.4.0-93-generic",
"platform_system": "Linux",
"platform_version": "#116-Ubuntu SMP Fri Aug 11 21:17:51 UTC 2017",
"python_full_version": "2.7.12",
"python_version": "2.7",
"sys_platform": "linux2"
},
"pipfile-spec": 6,
"requires": {},
"sources": [
{
"name": "pypi",
"url": "https://pypi.python.org/simple",
"verify_ssl": true
}
]
},
"default": {
"beautifulsoup4": {
"hashes": [
"sha256:7015e76bf32f1f574636c4288399a6de66ce08fb7b2457f628a8d70c0fbabb11",
"sha256:11a9a27b7d3bddc6d86f59fb76afb70e921a25ac2d6cc55b40d072bd68435a76",
"sha256:808b6ac932dccb0a4126558f7dfdcf41710dd44a4ef497a0bb59a77f9f078e89"
],
"version": "==4.6.0"
},
"certifi": {
"hashes": [
"sha256:54a07c09c586b0e4c619f02a5e94e36619da8e2b053e20f594348c0611803704",
"sha256:40523d2efb60523e113b44602298f0960e900388cf3bb6043f645cf57ea9e3f5"
],
"version": "==2017.7.27.1"
},
"chardet": {
"hashes": [
"sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691",
"sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae"
],
"version": "==3.0.4"
},
"idna": {
"hashes": [
"sha256:8c7309c718f94b3a625cb648ace320157ad16ff131ae0af362c9f21b80ef6ec4",
"sha256:2c6a5de3089009e3da7c5dde64a141dbc8551d5b7f6cf4ed7c2568d0cc520a8f"
],
"version": "==2.6"
},
"requests": {
"hashes": [
"sha256:6a1b267aa90cac58ac3a765d067950e7dbbf75b1da07e895d1f594193a40a38b",
"sha256:9c443e7324ba5b85070c4a818ade28bfabedf16ea10206da1132edaa6dda237e"
],
"version": "==2.18.4"
},
"slacker": {
"hashes": [
"sha256:5d54950a1956c6faff3c82cd116aed4436cf0e322a72747d77b9189d5ec7f8cb"
],
"version": "==0.9.60"
},
"urllib3": {
"hashes": [
"sha256:06330f386d6e4b195fbfc736b297f58c5a892e4440e54d294d7004e3a9bbea1b",
"sha256:cc44da8e1145637334317feebd728bd869a35285b93cbb4cca2577da7e62db4f"
],
"version": "==1.22"
}
},
"develop": {}
}

View File

@ -6,29 +6,29 @@ Want to create a custom Slack emoji for every pokemon? Slack doesn't currently e
## Creating Emoji
You'll need Python and `pip` to get started. I recommend using [virtualenv](https://virtualenv.pypa.io/en/latest/) and possibly [virtualenvwrapper](https://virtualenvwrapper.readthedocs.org/en/latest/) as well. Standard best-practice Python stuff.
You'll need Python and `pip` to get started. I recommend using [pipenv](https://docs.pipenv.org/).
Prepare a directory that contains an image for each emoji you want to create. Remember to respect Slack's specifications for valid emoji images: no greater than 128px in width or height, no greater than 64K in image size. The base filename of each image file should be the name of the emoji (the bit you'll type inside `:` to display it).
Clone the project, create a new virtualenv, and install the prereqs:
Clone the project and install its prereqs:
`libxml` is required on your system, if you'd like to use the bulk export script.
```bash
git clone https://github.com/smashwilson/slack-emojinator.git
cd slack-emojinator
mkvirtualenv slack-emojinator
pip install -r requirements.txt
pipenv install
```
You'll need to provide your team name (the bit before ".slack.com" in your admin URL) and your session cookie (grab it from your browser). Copy `.env.example`, fill them in, and source it.
To grab your Slack session cookie:
* [Open your browser's dev tools](http://webmasters.stackexchange.com/a/77337) and copy the value of `document.cookie`
* Go to the Network tab
* Re-load page like https://{teamname}.slack.com/customize/emoji
* Find call to `emoji` (it is most likely the very top request)
* Scroll to `Request-Headers` and copy the value of Cookie and add to .env
* [Open your browser's dev tools](http://webmasters.stackexchange.com/a/77337) and copy the value of `document.cookie`.
* Go to the Network tab.
* Re-load your workspace's `https://{teamname}.slack.com/customize/emoji` page.
* Find the call to `emoji` (it is most likely the very top request).
* Scroll to `Request-Headers`, copy the value of "Cookie," and add to your `.env` file.
```bash
cp .env.example .env
@ -39,16 +39,16 @@ source .env
Now you're ready to go. Use a shell glob to invoke `upload.py` with the emoji files as ARGV:
```bash
python upload.py ${EMOJI_DIR}/*.png
pipenv run upload.py ${EMOJI_DIR}/*.png
```
:sparkles:
## Exporting Emoji
To export emoji, simply use `export.py` and specify an emoji directory:
To export emoji, use `export.py` and specify an emoji directory:
```bash
source .env
python export.py path-to-destination/
pipenv run export.py path-to-destination/
```