Zapier를 사용하여 Github Issue 작성을 트리거로 Python 스크립트에서 Qiita API를 두드려 새 게시하는 예
Github issue 생성을 트리거로 설정
 
 Set up Code by Zapier Run Python
input에 Github issue의 title/description 정의
 
 Qiita token
Qiita > settings > application에서 가져오기
 파이썬 스크립트 설정
 
 스크립트
input에 Github issue의 title/description 정의

Qiita token
Qiita > settings > application에서 가져오기
 파이썬 스크립트 설정
 
 스크립트

스크립트
import requests
import re
hashtags = re.findall(r'#([^\s]+)', input['title'])
# タイトルからハッシュタグを抽出してQiita API 用に整形
qiita_hashtags = []
for hashtag in hashtags:
    qiita_hashtags.append({ "name": hashtag, "versions": ["0.0.1"] })
# タイトルでハッシュタグが見つからなかった時
if not qiita_hashtags:
  qiita_hashtags = [{ "name": "ポエム", "versions": ["0.0.1"] } ]
item = {
    'title': input['title'],
    'body': input['body'],
    "coediting": False,
    'tags': qiita_hashtags,
    'private': False,
    'tweet': True,
}
url = 'https://qiita.com/api/v2/items'
token = input['token']
headers = {
 'Authorization': 'Bearer {}'.format(token),
 'Content-Type': 'application/json',
}
res = requests.post(url, headers=headers, json=item)
output = [res.json()]
트리거의 원래 Issue
                
                    
        
    
    
    
    
    
                
                
                
                
                    
                        
                            
                            
                            Reference
                            
                            이 문제에 관하여(Zapier를 사용하여 Github Issue 작성을 트리거로 Python 스크립트에서 Qiita API를 두드려 새 게시하는 예), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
                                
                                https://qiita.com/YumaInaura/items/3ff9cd5a1855b3e119d6
                            
                            
                            
                                텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                            
                            
                                
                                
                                 우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)
                            
                            
                        
                    
                
                
                
            
Reference
이 문제에 관하여(Zapier를 사용하여 Github Issue 작성을 트리거로 Python 스크립트에서 Qiita API를 두드려 새 게시하는 예), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/YumaInaura/items/3ff9cd5a1855b3e119d6텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                                
                                
                                
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)