The group I belong to suddenly decided to introduce Qiita: team, "I want to move the Tip and know-how files that were originally shared in text to the Qiita Team." And that. .. .. I decided to try it first.
→ "You can always see the text via the web" → "Tag and manage easily" → "You can skip mentions within the team and have them read." I came up with something that looks good. .. .. I implemented batch posting with Qiita API.
I started implementing it with a light feeling, but I ran into some problems.
According to the Qiita API (http://qiita.com/docs/api#14) You can put name and version in the input tags.
before.json
{
"title": "test",
"body": "This is a test posting.",
"tags": {
"name": "tips"
},
"team_url_name": "ourteam"
}
I used to feel that. .. ..
after.json
{
"title": "test",
"body": "This is a test posting.",
"tags": [
{
"name": "tips"
}
],
"team_url_name": "ourteam"
}
I was able to do this. This is a rudimentary mistake.
Even if I try to convert shift-jis to utf-8 on Mac, I noticed that there are several text files that cannot be read for some reason. When I open it with cotEditor. .. .. Windows DOS?
When I looked it up, it seemed to be the character code cp932. In the code implemented in Python, it seemed to be recognized separately from shift-jis.
When posting a text file in any directory I decided to put that directory name in the tag. However, I don't know how to get a character string efficiently.
file_name, ext = os.path.splitext(file)
tag_line = files[len(path)+1:]
tag_list = tag_line.split('/')
Separate the file name and extension Cut the character string below path with'/' While implementing, "Oh, I wonder if there is a smarter way." I was coding with that in mind. (For the time being, I was able to get the character string as a tag as an array without any problem by this method.)
If you think about it carefully, you can only edit the account you posted, so Later, I manually changed it to "co-editing", Tohoho.
When I contacted Mr. Qiita about this matter, It seems that it is supported by Qiita API v2 under development. I'm looking forward to it.
https://github.com/tkshnkmr/qiita_api
Recommended Posts